I am trying to set a link in an hyperlink custom c...
# ask-stanley-ai
p
I am trying to set a link in an hyperlink custom column with a postSourcing function, but the result is a string, not a link... what can it be?
c
AI generated answer (using internal Slack threads):
It seems like you are trying to set a hyperlink in a custom column using a postSourcing function, but the result is a string, not a link. This could be due to the way you are setting the hyperlink. In SuiteScript, when you are creating a URL field, you can use the
linkText
property to set the display text for the hyperlink. However, this property works at the field level, not at the sublist level. This means that if you set the
linkText
for a URL field, it will apply to all the rows in that column. Here is an example of how you can set the
linkText
for a URL field:
Copy code
javascript
var dpidurl = updatedSublist.addField({
    id: 'dpidurl',
    type: serverWidget.FieldType.URL,
    label: 'View Demand Plan'
});
dpidurl.linkText = 'Edit';
If you want to have different link texts for different rows in the same column, you might need to create separate columns for each link. This is not an elegant solution, but it might work for your case. Alternatively, you could use a Free-Form Text field and create the hyperlink manually using HTML. Here is an example:
Copy code
javascript
'<a class="dottedlink" href="<https://static.url/>' || REGEXP_REPLACE({column}, 'e', '') || '" target="_blank">Link Text</a>'
In this case, you would replace
{column}
with the value you want to append to the static URL, and 'Link Text' with the text you want to display for the link. Note that you need to set the 'Formula' option to true and 'Store Value' to false for this field. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814737678
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807471514
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.800860226
Please provide your feedback on this answer.
p
how would I do in the script? in the post sourcing function?
r
The agent isn't yet programmed to respond to follow-up questions in the thread. but you can ask it again in the main channel.