Enter Mock Request Data Coming Into Your Script

Use data that simulates Request data to test that your Script functions as expected.

Enter Mock Request Data Coming Into Your Script

‌Use the Sample Input panel to mock Request data that comes into your Script to test how the Script runs using Request data you expect.

Define the variables in a Screen when you configure its controls. See information about each control.‌

Your user account or group membership must have the following permissions to enter mock Request data into a Script:

  • Scripts: View Scripts

  • Scripts: Create Scripts

  • Scripts: Edit Scripts

See the Scripts permissions or ask your Administrator for assistance.

Follow these guidelines to mock Request data coming into your Script:‌

  1. ​Open the Screen in which to view its JSON data model.

  2. Enter Preview mode on the Screen page to view its JSON data model. Click the Preview button from Screen Builder's top menu to enter Preview mode.

  3. Enter values into the control settings as if you were using the Screen in a Request. In the Data Preview panel, the JSON data model displays the key-value pairs in each object element. The keys' values are those you enter in the Screen preview. Understand what the key names are. Each key is derived from a Screen control's Variable Name setting value. Use these key names as variables in your Script. The Variable Name setting values become part of the Request data and contain the content that Request participants enter into that Screen during a Request. Mock these Variable Name setting values as input data to your Script.

  4. After you have entered values into the Screen in Preview mode, the entire JSON data model displays in the Data Preview panel. Copy the JSON data model.

  5. Paste the JSON data model into the Sample Input panel in Script Editor. If you use any variables as defined in the JSON data model in your Script, Script Editor uses those variable values during script testing.

  6. Optionally, mock the Magic Variables that your Script would reference during an in-progress Request. 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. Enter the Magic Variable into the Sample Input panel as part of the JSON data model, and then enter mock values for each. See Magic Variable Descriptions.

  7. Click Run.

  8. In the Output panel, view the mocked Request data.

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 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.