Dynamic External URLs
Created: September 6, 2017
This week's example looks at how we generate dynamic links in our List
of search
results. The example showed how to generate the NetSuite URL for a specific
record.
This technique can be used just as well for external URLs as well. Perhaps you have an integration built, and you want your search results to show a link directly to the same record in the integrated system. All we have to do is modify our base URL and the URL parameters we're sending.
For instance, perhaps you have that system located at http://myservice.com
,
and the typical path to a Project in that system is
like http://myservice.com?projectid=12345
It is common to store the ID of a record from an external system in
NetSuite's externalid
field, so we would just need to update our
URL ListColumn
like so:
list.addColumn({
id: 'recordurl',
type: ui.FieldType.URL,
label: 'Project Link'
}).setURL({
url: 'http://myservice.com'
}).addParamToURL({
param: 'projectid',
value: 'externalid',
dynamic: true
})
And that's it! We'd have dynamic links to our external system.