Skip to content

Developer Function: Server script: Functionalize

Overview

This function automatically converts code written in "Server Script" into an anonymous function. By converting it into an anonymous function, you can interrupt the server script at the point where you write "return;" in the code.

Limitation

  1. If "TryCatch" and "Make it a function" are checked at the same time, it will be converted into an anonymous function and then converted into a try-catch statement.
  2. If you write "return;" with "Make it a function" unchecked, an application error will occur. (The error is SyntaxError: Illegal return statement)

Example

Settings

JavaScript
// Preceding process
context.Log('Preceding process');
// Check if number A and number B are larger or smaller
if (model.NumA > model.NumB) {
    context.Log('Enter a value for number B that is larger than number A.');
    return;
}
// Subsequent process
context.Log('Subsequent process');

Execution result

When numA: 10 and numB: 100

The execution result when numA is 10 and numB is 100

When numA: 101 and numB: 100

The execution result when numA is 101 and numB is 100

Supported Versions

Supported versions Body
1.4.12.0 and later Added function