Wednesday, February 20, 2019

Set link text instead of the URL itself on custom body hyperlink field

There are instances where the user would like to set a link text that would mask the actual URL that is to be set on a custom body hyperlink field.

If the script that is to be used is not a Suitelet, a getField would be used instead of addField.

Below is a sample code:

function beforeLoad(type, form)
{
    form.getField('custbody4').setLinkText('secret link').setDefaultValue("https://www.yahoo.com");
}


Please take note though that this only works on view mode. By the time that you edit the record, the actual URL will be shown.

Also, the Store Value option on the custom body field record should be unchecked.

No comments:

Post a Comment