May I customize 'edit custom object records' page layout on SalesForce?

不羁岁月 提交于 2019-12-02 14:01:10

问题


For example, to create or edit an object, when I want to add or change some value to one specific field, I need to refer another website to retrieve some info.In this way, may I add one button or link on the edit page?

The help link of SalesForce is here: https://help.salesforce.com/apex/htviewhelpdoc?id=co_edit.htm&language=en_US

Thanks.


回答1:


Custom buttons and links don't display on new/edit page layouts so even if you'd make one, it will be visible only on detail view.

  1. Not too invasive option would be to create a URL or text fied, set it's default value to your link, make sure it's displayed on the page but readonly. Haven't tried it but should work (you'll have to test it as somebody other than System Administrator because you'll bypass the readonly property of the page layout).
  2. More invasive option would be to override the new and edit page layouts with Visualforce. More work but somewhat clean solution.
  3. Really crazy option would be to embed a piece of Javascript into section header on the standard page layout or even into sidebar. It's an ugly hack but it works, I've used it for example to disable editing of Name field.

To use method #3:

  1. create new section header, add something to the section (blank space is fine, you need something otherwise headers for blank sections aren't rendered), mark the section as visible on edit pages only.
  2. Section name has limit of 80 characters but can contain code like <script>document.getElementById('Name').disabled = true;</script>. You need longer script though to somehow create an URL at runtime and append it somewhere on the page near your "special" field.
  3. Upload a static resource with your script, then use this as the section header: <script src="filename.js" type="text/javascript"></script>

I'm not too proud of this hack and if you can - go with custom Visualforce new & edit page. It's quick & dirty, probably should be used only when you're not allowed to override pages.. but it works.



来源:https://stackoverflow.com/questions/11053278/may-i-customize-edit-custom-object-records-page-layout-on-salesforce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!