In NetSuite, you can use the standard function nlapiResolveURL() to create URLs for Suitelets and other script-based pages. The function signature is as follows:
nlapiResolveURL(type, identifier, id, displayMode);
Parameters:
- type: The type of script you are generating the URL for (e.g.,
'SUITELET'). - identifier: The internal ID of the script (e.g.,
'customscript_testscript'). - id: The deployment ID of the script (e.g.,
'customdeploy_testscript'). - displayMode: Optional parameter that defines how the URL will be accessed:
- Use
'external'to generate an external URL that can be accessed without logging into NetSuite (if permissions allow). - Use
null(or omit this parameter) to generate an internal URL that requires users to be logged into NetSuite.
External URL:
var externalUrl = nlapiResolveURL('SUITELET', 'customscript_jj_sl_estiamte_approve_or_c', 'customdeploy_jj_sl_estimate_approve_chan', 'external');
Internal URL:
var internalUrl = nlapiResolveURL('SUITELET', 'customscript_jj_sl_estiamte_approve_or_c', 'customdeploy_jj_sl_estimate_approve_chan', null);