I have a formula field that displays a text and has a link to record page, like this:

HYPERLINK('/'+ Id , Name__c)

The problem is, this has to work inside Salesforce but also in the community, and the problem is that in the community we have a relative url, like this:


So the final url using the formula field will be:


And it needs to be:


But if i had the '/s/detail' to the formula field it will stop working on Salesforce side.

Anyone has a solution for this? Using different fields it's not an option because they access the records in the community using the same listviews.


Have you tried using CASE function? you should try somthing like this below.

HyperLink( CASE(LEFT(BASE URL),"your communityurl", 
   LEFT(BASE URL),"https://instance.salesforce.com/", "'/'+ Id , Name__c"))

You can get your base url like below

LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))

let me know if this helps.

  • Hello, i was trying to avoid using a condition based on the community url because if we change this URL i have to update the formula field. Jul 23 '20 at 8:27
  • But thanks, of course this is a possible solution Jul 23 '20 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.