3

I have a URL field on my object, and i want it to display the "Link Text" not the actual URL, but I can't get the syntax right.

<a href="http://www.w3schools.com/">Visit W3Schools</a>

FWIW, the goal here is to populating this by a trigger. The link text = record name and the url = ID

6

Try out the option of using a formula(Text) field.

Formula Value : HYPERLINK( My_Link__c , 'Click This', 'Self')

My_Link__c can be your URL field which will contain the URL and replace 'Click This' with your own text. In your scenario, have another text field where you can populate the URL display text (i.e. Display_Text__c)

So formula can be modified as : HYPERLINK( My_Link__c , Display_Text__c, 'Self')

  • welcome to salesforce.stackexchange koushik. Usign the {} button in the editor you can make code & formulas stand out a bit. I've taken the liberty to do so in your answer. – Samuel De Rycke Feb 24 '14 at 18:35
  • I'm populating by trigger. that won't work – PartOfTheOhana Feb 24 '14 at 20:33
  • what exactly are you population via trigger? an object? can we see your code? normally a link is on a page, and a page pulls from a class/objects, not sure how you are doing this via trigger since a trigger doesn't exactly connect to a page.. more information is needed. – SalesForceGirl Feb 24 '14 at 20:43
  • If I've got your question correctly you are trying to create a URL whose 'URL value' and Text will be populated via trigger. – koushik Feb 25 '14 at 3:31
  • You can update these two values in two separate custom fields and create another formula field to use these fields and construct a link. – koushik Feb 25 '14 at 3:49

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.