Custom Links as Formula Fields

Salesforce.com lets you put custom links in the application. These can be hyperlinks to other objects in Salesforce.com, custom code, external sites, etc. You can dynamically create these links based on the context of the current object. So you can parameterize the URLs with Salesforce.com data, like address info. Here’s a custom link that pulls up a Yahoo! Map for the Contact’s address:

http://maps.yahoo.com/py/maps.py?cn={!Contact_MailingCountry}&csz={!Contact_MailingCity}+
{!Contact_MailingState}+{!Contact_MailingPostalCode}+&addr={!Contact_MailingAddress}

Until recently, you were very limited in where you could put your custom links on the page layout. You had to put them in a bucket called “Useful Links”, and only custom fields could go in there. But there is a better way. You can now create Formula fields that are Hyperlinks. Here’s a Hyperlink for a link to an S-Control I wrote for creating a new gift for a contact:

HYPERLINK(”/servlet/servlet.Integration?lid=00b30000000nIAI&eid=” & {!Id} , “Create a New Gift”)

The lid is the Id of the S-Control I wrote to create a new gift. The {!Id} is the Id of the Contact I’m coming from. So I’m calling custom code in the context of my current object.

Now I can put that link anywhere I want on my layout, and I can put descriptive text near it to make sure its function is understood. The descriptive text is put in as text Formula fields that has static descriptive content. That field is then put directly below the link.

Custom Fields Thumbnail

3 Responses to “Custom Links as Formula Fields”

  1. Dave Gurr Says:

    This is handy to know, thanks! Is there any way to invoke the HYPERLINK command without opening a new window though?

  2. Steve Says:

    Not that I know of. Hyperlink always opens a new window. As a best practice, I always suggest using a tabbed browser (i.e. Firefox) and having new windows open as tabs. Then the S-Control will be a little less invasive.

  3. gokubi.com » Blog Archive » Hyperlinks that call S-Controls break when you switch to Ajax toolkit 8+ Says:

    [...] The real answer to this is to call S-Controls from real buttons, and stop using fake hyperlink buttons. [...]

Leave a Reply