How to create a link on a field in a table component

  • 2
  • Question
  • Updated 2 years ago
  • Answered
HI community,

I have a text field (Asset_id__c) which generates a unique string when a record is created.

I have a table which shows the Asset_id__c text field on it. Now this just a custom field and doesn't act a link to navigate to the detail view of the record.

Is there any way to show it as a link and navigate to the detail view of the record when clicking on the link.

thank you
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Tom Scalzo

Tom Scalzo

  • 264 Points 250 badge 2x thumb
Avinash,
Have you tried a template field in it's place with the {{ }}?

Double “{{  }}” - subject to Field Rendering Code. Will display as a link

Triple   “{{{ }}}” - Not subjected to Field Rendering Code. Just shows the data (no link)

-- Tom Scalzo
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Yes. There is a skuid page called Asset_Detail and that is the detail page i wanted to redirect from this field.

Correct me if i am wrong.
{{{[local Id field name]}}} --> here within these brackets i am going to have the field API Name which is Asset_Id__c. and
in this area {{{name you want displayed}}} i will populate the Label of that field.

On the whole my href tag looks like this. {{{Asset id}}}

is this correct?
Photo of Tom Scalzo

Tom Scalzo

  • 264 Points 250 badge 2x thumb
Correct, however the displayed name should also point to a field.
Here's an example of passing Account Details to a page.

<a href="/apex/skuid__UI?page=AccountDetail&id={{{Account_vod__c}}}">{{{Account_vod__r.Name}}}</a>
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
I used this HTMl. {{{Asset_id__c.Asset Id}}}
Nothing worked.

I want to mention a point here. The string populated on this field is generated by trigger behind it.
Is that causing any issue?
Photo of Tom Scalzo

Tom Scalzo

  • 264 Points 250 badge 2x thumb
Hmm, that is a possibility.  The Template is taking the current value of field and passing it as an argument.  If the trigger is changing this value when the Detail page is rendered, then it is possible.
Here's some things we can check:
1) What is the URL results when clicking the displayed link?
2) If you inspect the model  (inspect page, console, skuid.model.map()), look at the data, what is an example value that you are seeing for this field?

Once you have this value, are you able to insert this into the URL to see that the value is actually a detail record?
Example: if your SF URL Prefix is na99, and the field value is '000999888' you would go to:
https://na99.visual.force.com/000999888?nooverride=1
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
There is only one string generated on a record and it will not change. So the trigger i have before insert trigger.
I exactly did not understand what do you meant by displayed link. Can you explain me about it?
Photo of Richard

Richard

  • 394 Points 250 badge 2x thumb
Avinash, as has already been mentioned above, you will need to use a template an
<a href=URL_to_link_to>{{Field_you_want_the_link_display_name_to_be}}</a> type structure.

URL_to_link_toDependent on whether you have set up a visualforce page to redirect to your detail page or not this will change what you write here. If you have set up the visualforce redirect, all you will need to place here is /{{{Id field of your record}}}. If you have not setup the redirect, then you will need something like Tom wrote above: /apex/skuid__UI?page=[name of page]&id={{{Id field of your record}}}

Field_you_want_the_link_display_name_to_be: This will be a field you have in your model, or simply text, that you would like the link to show up as.


For example: When we generate quotes from our opportunity pages we use this. We have a Skuid page called Quotes_View (that we needed because Salesforce used to not have their own Quote View that you could redirect). We had this template running on a table for our Quote model:

<a href="/apex/ui?page=Quotes_View&id={{{Id}}}">{{{Name}}}</a>

It redirects us to the Quote View page of the quote we selected but the link shows up in the table as the name of the quote.

Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Working. Thank you so much guys!!!
Photo of Richard

Richard

  • 394 Points 250 badge 2x thumb
Great :)