url.resolveScript(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Returns an external or internal URL to a script.

Returns

string

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/url Module

Since

2015.1

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.deploymentId

string | number

required

The script ID (string) or internal ID (number) of the deployment script.

2015.1

options.scriptId

string | number

required

The script ID (string) or internal ID (number) of the script. The ID must identify a RESTlet or a Suitelet.

2015.1

options.params

Object

optional

The object containing name/value pairs to describe the query.

2015.1

options.returnExternalUrl

boolean

optional

Indicates whether to return the external URL.

By default, the internal URL is returned (that is, the default value is false).

2015.1

Note:

Currently, it is not possible to call a Suitelet using its internal URL from a server script. You can either use this method and set the options.returnExternalURL parameter to true to get the external URL for the Suitelet, or you can pass the cookie from the server (and concatenate “https://” appropriately). However, note that a cookie cannot be retrieved in the afterSubmit entry point, although the request parameter from which it could be retrieved is available in the beforeLoad entry point and it could be transferred to afterSubmit. This approach is not for use in backend context.

Calling a Suitelet using its internal URL is only supported in client scripts because the browser automatically adds the cookie header to the request.

Errors

Error Code

Message

Thrown If

SSS_INVALID_URL

 

You attempt to call a Suitelet using its internal URL from a server script.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/url Module Script Samples.

          //Add additional code 
...
var output = url.resolveScript({
    scriptId: 'custom_script',
    deploymentId: 'custom_script_deployment',
    returnExternalUrl: true
});
...
//Add additional code 

        

Related Topics

N/url Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices