I have a child object to Case. That child object has a formula field that automatically gets populated with the account associated with Case. I want it to be a hyperlink. So it should show Account's name, and clicking on it should take a user to account.

One option is to make it a lookup field and use before insert trigger to automatically populate it.

But i want to do it via formula field. Where it automatically looks up the Account from the parent case .... the text displays the account name and it is a hyper link to account. Any suggestions would be helpful.

I know in the formulae field we can put HYPERLINK(link, displaytext, 'Self')

link and display text can be generated using some logic that goes like this - String link = URL.getSalesforceBaseUrl().toExternalForm() +'/'+Case__r.AccountID String displaytext = Case__r.Account.Name

Somehow i am unable to put it all together in a single formula that gives me desired result.

1 Answer 1


I believe you can easily calculate the link using this formula

HYPERLINK(LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260)) + CASE__r.AccountId, Case__r.Account.Name, 'SELF') 
  • N.B. Given that link is stored on a child object; the HYPERLINK could use relative URL. SFDC domain is typically required when link will be shared outside of salesforce - such as in a report that is exported to excel that in turn is used by an sfdc user
    – cropredy
    Oct 14, 2015 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .