To get the link of a particular record using the script

If we need to set the record id instead of setting it by hard coding, add the following code,

For Eg, we need the link to a particular sales order ‘123’

var salesOrderURL = url.resolveRecord({
    recordType: record.Type.SALES_ORDER,
    recordId: salesOrderId,
    isEditMode: false
}); // to get the link of the sales order
var companyInfo = config.load({
    type: config.Type.COMPANY_INFORMATION
});
var netSuiteDomain = companyInfo.getValue({
    fieldId: 'appurl'
}) // Toget the Netsuite Domain URL. Which is fetched from the company information page of the netsuite account.

By combining these ‘netSuiteDomain ‘ and ‘salesOrderURL’, we get the actual link. If it is a sandbox, then the value of ‘netSuiteDomain’ will be the link of the sandbox same for the production.

Leave a comment

Your email address will not be published. Required fields are marked *