How to: Grab Id of Row in Context and append to URL

edited February 4, 2020 in Questions
I'd like to create a custom hyperlink field that would grab the Id from the row in context and append it to the URL.

Example Table:
Account 1    www.example.com/Account1Id
Account 2    www.example.com/Account2Id
Account 3    www.example.com/Account3Id

I've tried using a HTML template field, but that doesn't exactly work. My JS knowledge is very limited. Can anyone point me in the right direction? 

Comments

  • Mark DeSimoneMark DeSimone 🛠️ 
    edited February 4, 2020
    Hi Josef, if you'd like this to be part of a table, you can do the following:
    Click on your table > Add Field(s) > Template. This will add a template field to your table, which you can manipulate to display in many different ways.
    Click on the new Template Field that was just added, and up in the Properties pane, check the "Allow HTML" checkbox. Then, just above that checkbox, you can add HTML like the following:
    <a href="https://foo.na35.visual.force.com/{{{Id}}}">link</a>
    You would replace everything up to the / with the portion of the URL that precedes the ID number. Using {{{Id}}} will insert the record's id number as text-only. (i.e. without any Salesforce metadata)

    If you're not using a table, you can take this kind of approach with a "template" component as well. Hope this helps!
  • edited January 23, 2017
    Thank you! I was using double "{" instead of triple..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!