Hello, I am trying to store a link in a custom bod...
# suitescript
k
Hello, I am trying to store a link in a custom body field (free form text) that displays the Text but holds the url value, using a user event script. Right now, I am storing the value like this:
Copy code
new_tracking_rec.setValue({
    fieldId: 'custrecord_tracking_link',
    value: '<a href="<https://www.fedex.com/fedextrack/?trknbr=12345677>">Tracking_Link</a>'
});
its currently being set as a text, neither as a link or the display Text mentioned in the href section. Is there anything that I am missing?
a
Inline html can not have a value, it must be sourced. Create a hidden text field, in your case probably with just the tracking number and the create an inline html field with the formula
'<a href="<https://www.fedex.com/fedextrack/?trknbr=|https://www.fedex.com/fedextrack/?trknbr=>' || {custrecord_tracking} || '" >Tracking Link</a>'
Rich text might work also.
k
thank you so much that works for me!
Is it also possible to use dynamic value for the text? in this case, instead of Tracking Link ?
g
give it a shot
k
I tried replacing Tracking List with _{custrecord_tracking_number}_ like below, but it just sourced _{custrecord_tracking_number}_ as a string:
'<a href="<https://www.fedex.com/fedextrack/?trknbr=>' || {custrecord_tracking} || '" >{custrecord_tracking_number}</a>'
g
thank you for trying and also showing what you tried. the
||
are a short-form of concatenate operator so you’ll need to repeat the pattern of joining strings and variables… you’re very close!
Copy code
'<a href="<https://www.fedex.com/fedextrack/?trknbr=>' || {custrecord_tracking} || '" >' || {custrecord_tracking_number} || '</a>'
k
thank you for your response! that did the trick!