将自定义链接/按钮添加到visualforce页面?

时间:2011-06-17 20:17:00

标签: salesforce apex-code visualforce

我在商机对象上有一个指向外部网站的自定义链接。是否可以将此自定义链接添加到visualforce页面?

我想出的解决方案是复制salesforce为此自定义链接创建的URL,并将其粘贴到页面中。它看起来像这样:

<a href="https://{!hostname}/servlet/servlet.Integration?lid=00bE0000000YbK3&eid={!opportunity.Id}&ic=1">my custom link</a>

这样可以正常工作,但是,一旦它安装在其他服务器上的托管包中,它将无法工作,因为盖子参数将不同(自定义链接ID)。有解决方案吗?

4 个答案:

答案 0 :(得分:0)

您是否考虑过在机会对象的字段中添加链接的URL,然后在VF页面上创建输出链接?

答案 1 :(得分:0)

查看$ Action。通过该全局变量可以获得按钮和链接。例如$Action.Opportunity.CustomLink

答案 2 :(得分:0)

为了建立danieljimenez的答案,$Action全局变量提供对按钮/链接对象的访问。从那里你需要使用URLFOR函数将其变为可用的形式。然后,您可以将其放入命令按钮的action参数中,或者在您标记的任何其他位置使用它。

<apex:commandButton action="{!URLFOR($Action.My_Obj__c.My_custom_link)}" value="My custom button"/>

<a href="{!URLFOR($Action.Calculation__c.My_custom_link)}">My link</a>

答案 3 :(得分:0)

创建新联系人(Salesforce按钮目标_blank)

mysql> select PAGE_URL,REFERRER_URL,SOURCE,TYPE from visitors limit 4;
+-------------------------------------------+-------------------------------------------+---------------+------+
| PAGE_URL                                  | REFERRER_URL                              | SOURCE        | TYPE |
+-------------------------------------------+-------------------------------------------+---------------+------+
| https://stackoverflow.com/html/arun1.html | https://stackoverflow.com/html/arun2.html | Direct Visits |    1 |
| https://stackoverflow.com/html/arun1.html | https://stackoverflow.com/html/arun3.html | Facebook      |    1 |
| https://stackoverflow.com/html/arun1.html | https://stackoverflow.com/html/arun4.html | Email         |    0 |
| https://stackoverflow.com/html/arun1.html | https://stackoverflow.com/html/arun5.html | Direct Visits |    0 |
+-------------------------------------------+-------------------------------------------+---------------+------+
相关问题