Pass Request Data into Your Script

Use Request data as input from which to run your Script.

Pass Request Data Into Your Script

‌Pass Request-related data into your Script in the following ways:‌

  • Request data: ProcessMaker Platform uses a schema-less JSON data model from which to read, write, and store Request data. Since the JSON data model is schema-less, meaning that it does not require a specific schema or structure from which ProcessMaker Platform assets must conform, the JSON data model is structured from the JSON objects in assets used in a Request, such as the Variable Name setting values in a Screen or variables a Script creates. When an in-progress Request routes through the Process, Request data aggregates into the JSON data model, thereby becoming Request data. Users or group members that have the Requests: Edit Request Data permission may view the JSON data model for a completed Request. This JSON data model displays from the Data tab in a completed Request's summary. Below is an example. Scripts can call Request data by referencing these JSON objects derived from Variable Name setting values in Screens.

  • Script Task element Configuration: Enter JSON data to pass to the Script when configuring the Script task element in Process Modeler. In the example below, the data from JSON Variable Email is being passed to the Script using the Script Configuration panel of a Script Task element. Note that revisions made to Script Config Editor screen do not save until the Close button is clicked.

  • Magic Variables: ProcessMaker Platform uses a set of Magic Variables that become part of the JSON data model for all Requests. ProcessMaker Platform uses these Magic Variables to store user, Process, and Request related data for all Requests. During an in-progress Request, these Magic Variables are updated. All Magic Variables are preceded by an underscore (_) character in the JSON data model. See Reference Magic Variables in ProcessMaker Platform Assets.

  • Environment Variables: The sensitive information that an Environment Variable represents can pass to a Script when it runs. Usage depends on the programming language that the Script uses. In the usage examples below, ENV_VAR_NAME represents the name of the Environment Variable. See Variable Syntax, Usage, and Examples.

pageScript Editor OverviewpageGenerate Your Script Using AI AssistantpageClean a Script to Improve its CodepageDocument a ScriptpageExplain How a Script FunctionspageDevelop Your Script in Script EditorpageEnter Mock Request Data Coming Into Your ScriptpageEnter Other JSON Data as Input to Your ScriptpageTest Your ScriptpagePass Request Data into Your ScriptpageEnvironment Variable and Magic Variable Syntax, Usage, SDK, and Script Examples

Last updated

© Copyright 2000-2024 ProcessMaker Inc. All rights reserved.