Retrieve the Relative URL of a Record
The following sample shows how to retrieve the relative URL of a record. With the internal ID value used in this sample, the returned output is /app/accounting/transactions/salesord.nl?id=6&e=T&compid='
, followed by the NetSuite account ID.
This sample script uses the require
function so that you can copy it into the SuiteScript Debugger and test it. You must use the define
function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.
The value used in this sample for the recordId
field is a placeholder. Before using this sample, replace the recordId
field value with a valid value from your NetSuite account. If you run a script with an invalid value, an error may occur.
/**
* @NApiVersion 2.x
*/
// This script retrieves the relative URL of a record.
require(['N/url'], function(url) {
var output = url.resolveRecord({
recordType: 'salesorder',
recordId: 6,
isEditMode: true
});
});