Script

Overview

The Script component is used to process data. You can use a specified programming language to compile a script, process the data transferred to the Script component, and generate new data for subsequent steps.

Configuration

Table 1 Script

Parameter

Description

Script Language

Programming language used for writing scripts. Currently, only the JavaScript language of the ES5 version is supported.

Script Content

Contents of a script.

You can use a simple expression to reference the data in the preceding steps. For details, see Data Reference.

To parse content data in JSON format, you can use JSON.parse('${body}') to convert the content data into a JSON object and then parse the data.

The Script component can generate an output result and transfer it to subsequent steps. You need to specify the name of the variable to be output at the end of the script. For example:

function getUser(){
    return {"id": ${property.id},"name":"${property.name}"};
}
var user=getUser();
user;

In subsequent steps, you can reference the output of the Script node by using ${property.script_result}.

In Script Content of the Script component, if you need to write a function or logic code block, use "{" and "}" to surround the code block.