The N/url module generates URLs to NetSuite records, tasks, search results, Suitelets, and RESTlets. It is especially useful for building links in emails, PDFs, or dashboard portlets.
Generate a Record URL
define(["N/url", "N/log"], (url, log) => {
const recordUrl = url.resolveRecord({
recordType: "salesorder",
recordId: 12345,
isEditMode: false
});
log.debug("Sales Order URL", recordUrl);
return {};
});
Generate a Suitelet URL
const suiteletUrl = url.resolveScript({
scriptId: "customscript_my_suitelet",
deploymentId: "customdeploy_my_suitelet",
returnExternalUrl: true,
params: { mode: "view", id: "123" }
});
log.debug("Suitelet URL", suiteletUrl);
Key Methods
| Method | Description |
|---|---|
url.resolveRecord(options) | Get URL to a specific record |
url.resolveScript(options) | Get URL to a script (Suitelet, RESTlet) |
url.resolveTaskLink(options) | Get URL to a NetSuite task link |
url.format(options) | Format a URL with query parameters |