Component Code JS
Description
Executes the JS code specified by the argument in the product layer microservice.
Passes as input either an object with variable values or an object with the specified named arguments.
Any actions can be performed inside the body with application of the passed object in the context of the product layer.
On exit, the returned result is stored in a variable and also, if an object is returned, all its keys are mapped to the existing variables in the script and the values are saved.
Example: "return { a: x + y.name + z[0].caption };" for passed variables or parameters x = "abc", y = {"name": "def"}, z = [{"caption": "ghi"}] will return "abcdefghi" and assign to the existing script variable 'a', and body "{ a: "abcdefghi" }" to the return variable if given.
You can perform an asynchronous query if necessary: "return async function() { await GlobalUtils.wait(500); return { a: 1, b: x }; }".
Index |
|
Short title |
|
Types of scenarios |
|
Starter module |
|
Mode |
Asynchronous |
Icon |
![]() |
Branching pattern |
Branching |
Limitations
-
If a timeout is triggered, the script stops waiting for a response and passes control to the next component, the executed method is not terminated.
Properties
Specification | Description |
---|---|
Title: |
JS function code to be executed in node.js in a product layer microservice environment. |
Title: |
Switches the parameter setting mode for the runtime environment. Possible values:
When passing JSON string values, representing objects are available in code as objects, JSON arrays are available as arrays, strings and numbers default to strings, dates as a string, and blank values are left blank (null). |
Title: |
List of parameters to be passed and their names. If the value is a JSON string with an object or array, the object or array will be accessed directly in the JS code when the corresponding variable is accessed. |
Title: |
Argument defining the timeout of code execution in the node JS. |
Title: |
Variable where the full body of the execution result is stored. |
Title: |
Variable where the string with the error code and text is saved. |
Title: |
Component to which control is passed. |
Title: |
Component to which control is passed in case of timeout. |
Title: |
The component to which control is passed in case of an error. |