NeverSuite
06/16/2025, 3:36 PMCeligo AI
06/16/2025, 3:36 PMAI generated answer (using internal Slack threads):In SuiteScript, you can determine the type of script that is currently running by using the
runtime.executionContext
property. This property returns a string that represents the context in which the script is being executed.
For example, if the script is a User Event script, runtime.executionContext
will return 'USEREVENT'. If the script is a Client script, runtime.executionContext
will return 'CLIENT'.
However, it's important to note that the execution context is determined by the action that triggers the script, not the type of script itself. For instance, if a User Event script is triggered by a client action, the execution context will be 'CLIENT', not 'USEREVENT'.
Here is a code snippet that demonstrates how to use `runtime.executionContext`:
javascript
var context = runtime.executionContext;
if (context === runtime.ContextType.USEREVENT) {
log.debug('This script is running as a User Event script');
} else if (context === runtime.ContextType.CLIENT) {
log.debug('This script is running as a Client script');
} else {
log.debug('This script is running in a different context: ' + context);
}
Remember, this code will only work if the script is triggered in the appropriate context. If a User Event script is triggered by a client action, the execution context will be 'CLIENT', not 'USEREVENT'.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/16/2025, 3:37 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82515347
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82112062
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818925261
Celigo AI
06/16/2025, 3:37 PM