Modules

filter

 

Objects/Functions

module (N/runtime)

SuiteScript 2.0

runtime.executionContext

// Please search https://system.netsuite.com/app/help/helpcenter.nl?search=runtime.executionContext for more information.

N/runtime Module
runtime.executionContext
Property Description: The execution context trigger of the current script. Execution contexts provide information about how a script is triggered to execute. For example, a script can be triggered in response to an action in the NetSuite application, or an action occurring in another context, such as a web services integration. You can use execution context filtering to ensure that your scripts are triggered only when necessary. For more information, see Execution Contexts. You can use the runtime.executionContext property to determine the execution context for a script and choose different logic depending on the context. Consider a script that applies to customer records and uses the beforeLoad(scriptContext) entry point. You may not want to execute this script when the entry point is triggered in response to a REST web services request. To prevent the script from executing in this context, you can do the following: This property uses values from the runtime.ContextType enum.
Type: string (read-only)
Supported Script Types: Client and server scripts For more information, see SuiteScript 2.0 Script Types.
Module: N/runtime Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=runtime.executionContext

Example:

// Code Example 1
if (runtime.executionContext === runtime.ContextType.REST_WEBSERVICES) {
return;
}

// Code Example 2
// Add additional code
//...
if (runtime.executionContext === runtime.ContextType.USEREVENT)
return;
//...
// Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4296531348.html