Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Create a new Script to automate or add functionality to any Process.
Follow these steps to create a new Script:
View your Scripts. The Scripts page displays.
Click the +Script button. The Create Script screen displays.
From the Choose an Executor section, select a programming language to use for creating your script. Your Administrator may have created custom Script Executors using ProcessMaker Platform-supported languages to run sanctioned custom third-party code and/or Docker commands that allow Scripts to successfully call third-party Application Program Interfaces (APIs) and Software Development Kits (SDKs). To know more about the available executors, see What is a Script Executor?. This setting is required.
In the Name setting, enter the name of the Script. Script names must be unique and can only use apostrophe characters ('
) and spaces. This is a required setting.
In the Description setting, enter the description of the Script. This is a required setting.
At the bottom right, click the Advanced Options link. Advanced options display.
Click the Less Options link to hide advanced options.
From the Run Script As drop-down menu, select which user's API client token to use with our REST API. Ensure that the selected user's account has the appropriate API permissions to access our REST API. By default Administrator user is selected. This is a required setting.
In the Timeout setting, enter how many seconds the Script is allowed to run before it times out. Use 0
to indicate that the Script never times out. The default timeout is 60 seconds. This setting requires an integer.
In the Retry Attempts setting, configure how many times to re-run the Script if the Script fails. Enter 0
for no retry attempts.
In the Retry Wait Time setting, configure how many seconds to wait before attempting a retry . Enter 0
for no wait time.
Click Save. Script Editor displays so you can develop your Script. See Script Editor.
Edit the configuration for a Script.
Enhance ProcessMaker Platform security for your ProcessMaker Platform instance by following these best practices. Among these best practices are to verify all user accounts that run Scripts are valid and appropriate.
Review the Run script as setting described below for each Script to determine which user's API client token to use with the ProcessMaker REST API.
Follow these steps to configure general settings for a Script:
View your Scripts. The Scripts page displays.
Edit the following information about the Script as necessary:
In the Name setting, edit the unique name of the Script. This is a required setting.
From the Run script as drop-down menu, select which user's API client token with appropriate permissions to use with the ProcessMaker Platform REST API. This is a required setting.
From the Script Executor drop-down menu, select which Script Executor to run this Script. This setting only displays Script Executors that this Script has been developed using. Your Administrator may have created custom Script Executors using ProcessMaker Platform-supported languages to run sanctioned custom third-party code and/or Docker commands that allow Scripts to successfully call third-party Application Program Interfaces (APIs) and Software Development Kits (SDKs). Below are the Script Executors ProcessMaker Platform provides, though some require packages to be installed:
csharp - C# Executor: This is the default Script Executor to run Scripts developed using C#.
java - Java Executor: This is the default Script Executor to run Scripts developed using Java.
javascript - Node Executor: This is the default Script Executor to run Scripts developed using JavaScript.
lua - LUA Executor: This is the default Script Executor to run Scripts developed using Lua.
python - Python Executor: This is the default Script Executor to run Scripts developed using Python.
r - R Executor: This is the default Script Executor to run Scripts developed using R.
This is a required setting.
In the Description setting, edit the description of the Script. This is a required setting.
In the Timeout setting, use the slider control or enter how many seconds the Script is allowed to run before it times out. Use 0
to indicate that the Script never times out. The default timeout is 60 seconds. This setting requires an integer.
In the Retry Attempts setting, configure how many times to re-run the Script if the Script returns a runtime error as follows:
Enter a number. Use the up and down arrows to increase or decrease the number.
Set 0
for no retry attempts.
In the Retry Wait Time setting, configure how many seconds to wait before attempting a retry as follows:
Enter the number of seconds. Use the up and down arrows to increase or decrease seconds.
Set 0
for no timeout.
Click Save.
Enable a Script to function as an Application Program Interface (API) endpoint. Use a Script as an API endpoint to perform multiple scripting tasks that do not require be run from a Process. The Script may use either GET
and/or POST
methods as an independent endpoint. By enabling the Script with direct API access, a unique API URL is generated. Copy the API URL and insert it wherever that Script's API endpoint must be called. Enabling and then disabling a Script's API access maintains the same API URL.
Configure API access settings independently from the Script's basic settings. API access settings require the following:
Specify Basic Authentication of user name and password, if used.
Specify from which URLs may access the Script's independent API endpoint if other Scripts run this one.
Refer to the following HTTP responses for their corresponding events when using a Script's API endpoint:
200 OK
: The Script's API endpoint successfully returns the JSON response when set to run synchronously.
204 No Content
: There is no content for the Script API endpoint to return because it is being run asynchronously. The Script's API endpoint successfully fulfilled the request and that there is no JSON response in payload body.
Error 403 Forbidden
: The Script's API access is not accessible to that URL. Grant that URL access.
Error 404 Not Found
: The Script's API access is not available. Enable the Script's API endpoint.
Use an application like Postman that can send API requests to the Script to more easily inspect and debug the Script's API endpoint responses.
Follow these steps to enable a Script with API access as an independent endpoint:
View your Scripts. The Scripts page displays.
Locate the Enable Direct API access setting. This setting is disabled by default.
Select the Enable Direct API access toggle key. Settings display to configure the Script's API access.
Disable the Run Synchronously toggle key to run the Script asynchronously. The Run Synchronously toggle key is enabled by default.
From the Accepted methods setting, select which method(s) this Script uses as an endpoint:
GET/ Query String: The GET / Query String method retrieves data using parameters passed in the Script's auto-generated URL. The GET toggle key is disabled by default.
POST: The POST method sends JSON data as provided in the Script. The POST toggle key is enabled by default.
From the Authentication setting, select either None or Basic Authentication as the authentication method. Follow these steps to configure basic authentication settings when selecting the Basic Authentication option from the Authentication section:
In the User setting, enter or edit the user name that the Script authenticates endpoint access.
In the Password setting, enter or edit the password that the Script authenticates endpoint access.
From the Allow Access From setting, enter or edit from which URLs may access this Script's endpoint. The default setting is All, allowing any URL to access the Script's endpoint. Follow these guidelines to specify URLs:
Click the +URL button to add a URL. A field displays to enter the URL.
Enter the URL that this Script allows access to its endpoint.
From the API URL setting, copy the generated API endpoint and insert it wherever that Script's API endpoint must be called.
Click Save.
A version is a set of changes made to a Script at a particular time by a Process designer. Versioning maintains a record of all named and unnamed changes to that Script. Any of these versions may be viewed or retrieved, if needed. The Version History page displays all saved versions of the Script in a tabular format from where they can be edited and/or marked as the Current Version
according to your business needs. The current version of a Script is used in all new Requests in which that Script is run from Script Task elements or Watchers. Version changes are not reflected in Requests which were in-progress or already completed when the version changed.
Follow these steps to view or edit the version history of your Script:
View your Scripts. The Scripts page displays.
Click on the Version History tab. The Version History page displays.
Date: The date and time of when a Process Designer saved this version in Script Editor.
Current Version: The most recent version of the Script is displayed at the top and is marked as the Current Version
. This version is used in all in-progress and new Requests.
Name: The name of this version as entered by a Process designer when saving the Script in Script Editor.
Description: A description of the changes in this version as entered by a Process designer when saving the Script in Script Editor.
Saved by: The name of the Process designer who saved this version.
Toggle the Only show named versions toggle key to show only the versions with a name assigned to them.
Optionally, edit any of the following existing details about this named version:
In the Version Name setting, edit the name to this named version. If saving this named version with no name, this version does not display in the Version History page if the Only show named versions toggle key is enabled.
In the Additional Details (optional) setting, edit the details about this version. For example, describe the changes in this version for auditing, historical, or maintenance purposes.
Click Confirm and Save to save your changes. Otherwise, click Cancel.
Click Confirm and Save to set this version as the current version. Otherwise, click Cancel.
Use ProcessMaker AI to code, document, and test your Script in a secure and isolated environment.‌
Use Script Editor to code, document, and test your Scripts. Any Script can be used in any Process in your organization developed using programming languages that Script Editor supports.‌
More efficiently produce your Scripts with ProcessMaker's AI assistant, Cornea AI. Use Cornea AI's no-coding option in the following ways to more efficiently produce Script assets:
Generate a Script using a natural language description of its function: Use almost any natural language to describe the Script's intended functionality.
Clean a Script to improve its code: Clean a Script to improve its coding structure and efficiency. Your Script does not need to have been generated by Cornea AI to clean it.
Document a Script: Use Cornea AI to add comments into the Script to document its functionality. Your Script does not need to have been generated by Cornea AI to document it.
Explain how a Script functions: Use Cornea AI to explain how a Script functions. Provide a Script, and Cornea AI describes its functionality in simple natural language. As with other Cornea AI features, your Script does not need to have been generated by Cornea AI to explain its functionality.
Note that Cornea AI features are only available when using Scripts in JavaScript or PHP programming languages.
Scripts run securely and in isolation from within Docker containers called Script Executors. The Script Executor for each supported programming language contains the Software Development Kit (SDK) that supports extensibility to provide programmatic interaction with ProcessMaker Platform. When the ProcessMaker Platform instance calls a Script to run, the Script Executor for that programming language creates a Docker container corresponding with that programming language, runs the Script, and then destroys the Docker container. This ensures that any malicious script that anyone in your organization might inadvertently introduce to ProcessMaker Platform does not affect the instance or its hosting environment: Docker containers cannot access them. Furthermore, Docker containers cannot listen for inbound connections; therefore, a Docker container cannot be accessed externally.
Scripts are developed and tested in the same environment.
‌Below is the Script Editor displaying a Script written in PHP.‌
Generate a Script using ProcessMaker's Artificial Intelligence (AI) without using code. Describe how the Script is to function using natural language.
ProcessMaker's AI Assistant in Script Editor helps you create highly usable scripts faster than coding them yourself. Generate a Script without knowing how to code. Use almost any natural language to describe the Script's intended functionality.
For example, describe a Script to perform the following functionality using the following text:
First, visit a reputable travel website or an airline's official website. Next, enter the departure and destination locations, along with the preferred travel dates.
There is no need to describe which programming language in which to generate this Script because you select that programming language when creating the Script prior to describing its function.
Note that this feature is only available when creating a Script using JavaScript or PHP programming languages.
Follow these steps to generate a Script using a natural language description of its function:
The AI Assistant features display.
Click the Generate Script From Text option. The Generate Script From Text panel displays.
In the Description setting, enter a natural language description of how the script is to function. One Script description may use no more than 1000 tokens. A token is a common sequence of characters found in text for a particular language. Generally, one token corresponds to approximately four (4) characters of common English-language text. This corresponds to approximately 100 tokens to about 75 words in English. To the right of the Description label displays how many tokens your description currently uses. If your description exceeds 1000 tokens, shorten the length of your description.
Optionally, click the Give me inspiration! link for examples. From the Need Inspiration? field, view English-language phrases how to describe specific functions to generate in the Script. Click a phrase or phrase template to copy it into your Clipboard, and then paste it into into the appropriate location in your description.
Click the Generate button. The Before you continue screen displays.
Position your cursor in the position within Script Editor to place the generated script. By default, the cursor positions at the beginning of Line 1. Click the Confirm button. AI Assistant processes the natural language prompt describing the script, and then Script Editor displays two panes:
Current Script: The Current Script pane displays the script prior to the AI-generated script.
AI Generated Response: The AI Generated Response pane displays the AI-generated script. Differences in code from the script in the Current Script pane display with the following code highlighting:
Additional code: Additional code displays with a green-colored highlight.
Removed code: Removed code displays with a red-colored highlight.
Click one of the following buttons from the AI Generated Response pane:
Apply Changes: Click the Apply Changes button to accept the AI-generated script. Script Editor displays the AI-generated script in its default view.
Cancel: Click the Cancel button to not accept the AI-generated script. Script Editor displays the current script in its default view.
Clean a Script to improve its coding structure and efficiency. Your Script does not need to have been generated by AI Assistant to clean it.
Follow these steps to use AI Assistant to clean a Script:
Edit a Script in which to clean.
Expand the AI Assistant panel. The AI Assistant features display.
Click the Clean option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes:
Current Script: The Current Script pane displays the script prior to recommended cleaning.
AI Generated Response: The AI Generated Response pane displays the AI-cleaned script. Differences in code from the script in the Current Script pane display with the following code highlighting:
Additional code: Additional code displays with a green-colored highlight.
Removed code: Removed code displays with a red-colored highlight.
If Cornea AI recommends no cleaning changes, the following message displays: Nothing to clean..
Click one of the following buttons from the AI Generated Response pane:
Apply: Click the Apply button to accept the AI-cleaned script. Script Editor displays the AI-cleaned script in its default view.
Cancel: Click the Cancel button to not accept the AI-cleaned script. Script Editor displays the current script in its default view.
Use ProcessMaker's AI Assistant to add comments into the Script to document its functionality. Your Script does not need to have been generated by AI Assistant to document it.
Follow these steps to use AI Assistant to document a Script:
Generate or edit a Script to document.
Expand the AI Assistant panel. The AI Assistant features display.
Click the Document option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes:
Current Script: The Current Script pane displays the script prior to its documentation.
AI Generated Response: The AI Generated Response pane displays the AI-documented script. Additional lines of code that document functionality display with a green-colored highlight.
Click one of the following buttons from the AI Generated Response pane:
Apply: Click the Apply button to accept the AI-documented script. Script Editor displays the AI-documented script in its default view.
Cancel: Click the Cancel button to not accept the AI-documented script. Script Editor displays the current script in its default view.
Use ProcessMaker's AI Assistant to explain how a Script functions. Provide a Script, and AI Assistant describes its functionality in simple natural language. Your Script does not need to have been generated by AI Assistant to explain its functionality.
Follow these steps to use AI Assistant to explain how a Script functions:
Edit a Script in which to explain how it functions.
Expand the AI Assistant panel. The AI Assistant features display.
Click the Explain option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes:
Current Script: The Current Script pane displays the script to be described its function.
AI Explanation: The AI Explanation pane displays the following structure within the explanation for the displayed script:
Summary: The Summary section describes in overview the displayed script's function.
Explanation: The Explanation section describes a sequential order in runtime what the script does in natural language.
Use Request data as input from which to run 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.
‌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.‌
Follow these guidelines to mock Request data coming into your Script:‌
​Open the Screen in which to view its JSON data model.
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.
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.
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.
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.
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.
Click Run.
In the Output panel, view the mocked Request data.
‌Use the Configuration panel to include JSON configuration settings your Script uses when it runs. For example, include the Client ID and Client Secret values in JSON format for OAuth 2.0 verification to a third-party service's API your Script must access to access the API. By entering these values into the Configuration panel, you can verify during testing that these values are valid for the third-party service.‌
A Script may reference Screen control values during a Request by placing their Variable Name setting values within quotation marks ("
). In the example below, FullName
is the Variable Name setting value for a control to store a Request participant's full name:
Understand how to develop a Script in Script Editor.
‌Develop the Script below the script's name and language description. Use the scroll panel to navigate your code not currently displayed. This is useful especially when editing a long Script.‌
Revisions made to Script Config Editor screen do not save until the Close button is clicked.
When discarding a draft of your Script, Script Editor discards all changes to that Script since its last publication.
Follow these steps to discard changes to your Script since its last publication:
Click the Discard button. Script Editor discards the changes since last starting to edit that Script, and then closes. The Scripts page displays.
Since Script Editor saves changes to your Script automatically, it is not necessary to manually save your changes. However, you may close Script Editor without publishing your changes, but keep all your changes intact.
A Script can be published in two ways. See the following sections regarding how a Script may be published:
Publish a single version of your Script.
Publish distinct versions of your Script.
Click the Publish button from Script Editor's top menu to publish the Script.‌ This action overwrites the previous publication of this Script without maintaining a record of its previous publication(s).
Follow these guidelines to publish a new distinct version of your Script:‌
Click the Publish button from Script Editor's top menu.‌
Do one of the following:
Publish an unnamed version:
Follow these steps to publish an unnamed version:
Save a named version:
Follow these steps to publish a named version:
In the Additional Details (optional) setting, optionally enter details of the changes made in this version. The additional details display when viewing the version history of that Script and helps other Process Designers or Administrators understand the changes made in that version. Enter details which concisely summarize the changes made in this version.
Click Save to save this version. Otherwise, click Cancel to return to Script Editor without publishing.
Reference Environment Variables and Magic Variables in your Scripts.
Data: The data
variable is a JSON object that contains all Request data to the moment a Script runs.
‌Refer to the tabs below how to use variables in supported programming languages.
Below is a sample Script that uses PHP. Refer to the comments denoted with //
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses Lua. Refer to the comments denoted with --
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses JavaScript. Refer to the comments denoted with //
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses C#. Refer to the comments denoted with //
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses Java. Refer to the comments denoted with //
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses Python. Refer to the comments denoted with #
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
Below is a sample Script that uses R. Refer to the comments denoted with #
that describe how the sample functions:
How to get a value from the configuration object.
How to get a value from a data object.
Call the Software Development Kit (SDK).
The following sample PHP script provides an example to get all Tasks currently assigned to a user. This example also demonstrates the use of optional arguments such as the Request ID or a Task filter.
The following sample PHP script provides an example to retrieve a single Task using its Task ID.
The following sample PHP script provides an example of completing a Task when the Task ID is known.
If a script runs under a different user than the one who started the request and the task involves date variables, automatic detection and formatting of Datetime variables will not occur. Users must manually implement date formatting logic within their scripts.
Here is a sample to retrieve, format, and apply a date format to a Datetime variable using a sample PHP script:
From the Project drop-down menu, optionally select the Project(s) for this script. This setting only displays Projects of which you are a member. To remove a Project that is currently selected, click the icon for that selection or press Enter
when the drop-down is visible.
From the Category drop-down menu, select one or more Script Categories to associate with this Script. In doing so, Script Categories may be sorted from the Scripts page. To remove a Script Category that is currently selected, click the icon for that selection or press Enter
when the drop-down is visible. This is a required setting.
Click the menu, and then select the Configure option for your Script. The Edit Configuration page displays.
From the Category drop-down menu, select one or more Script Categories to associate with this Script. In doing so, Script Categories may be sorted from the Scripts page. To remove a Script Category that is currently selected, click the icon for that selection or press Enter
when the drop-down is visible. This is a required setting.
From the Project drop-down menu, optionally select the Project(s) that this Script becomes an asset. This setting only displays Projects of which you are a member. This setting only displays Projects of which you are a member. To remove a Project that is currently selected, click theicon for that selection or press Enter
when the drop-down is visible.
Click the menu, and then select the Configure option for your Script. The Edit Configuration page displays. Ensure that the Script's basic settings are configured properly to run.
Click the Deleteicon to delete the URL, if necessary.
Click the menu, and then select the Configure option for your Script. The Configuration tab of the Edit Configuration page displays.
The Version History page organizes versions in a monthly format and displays the following information:
Click the Change Version Details iconto edit version details for this version. The Change Version Details screen displays.
Click the Copy to Latest iconto set a version as the current version. The Copy to Latest screen displays.
The screen displays the warning This version will become the active version for this asset
,
indicating that this action will set this version as the current version.
While in Script Editor, expand the AI Assistant panel.
‌Click the Run button to test your . Script Editor evaluates any JSON data entered into the Configuration and Sample Input panels.‌
Click the icon to open a preview of the data. The Output Preview Panel displays the JSON structure and the Data Browser canvas. To navigate JSON data in the Data Browser, see .
Your user account or group membership must have the following permissions to create or edit a :
See the permissions or ask your Administrator for assistance.
Script Editor automatically saves your Script every five (5) seconds when changes are made to any of the configuration panels. Regardless of whether you prior to leaving Script Editor, the next time you edit that Script, the changes since its last publication remain intact.
While in Script Editor, click the ellipses menu, and then select Discard Draft.
While in Script Editor, click the Close button. Script Editor closes with your saved changes. The
Distinct versions of a Script can be published. A version is a set of changes published for a Script since the last publication. Versioning maintains a record of all named and unnamed publications to that Script. Any of these versions may be, if needed.
The Commit Changes screen displays to name that published version of this Script.
Click Save to publish an unnamed version. Otherwise, click Cancel to return to Script Editor without publishing. As a best practice, name each published version to provide auditing and documentation to what has changed in each publication. Otherwise, Process Designers that manage versions of this Script do not view unnamed versions when the Only show named versions toggle key is enabled while .
In the Version Name setting, enter a name for this version. The version name displays when viewing the and helps identify this version. Although this setting is not required, as a best practice name each version for easier maintenance, documentation, and auditing purposes. Name the version that describes changes in this Script.
‌ProcessMaker Platform uses two global variables that can call. Variable usage depends on the programming language that the Script uses. Below is a description of these global variables:‌
Config: The config
variable is a JSON object that contains any special configuration to be passed to the Script prior to it running. In elements of a Process model, special configurations are entered into the Script Configuration setting. See as to the best practice when configuring Scripts from Script Task elements in a Process model.
Every from which a Script runs has the following default from which a Script may get its value. Refer to the tabs below how to get these Environment Variable values for each supported programming language. Below is a description of these default Environment Variables.
How to get an .
How to get an .
How to get an .
How to get an .
How to get an .
How to get an .
How to get an .
Environment Variable | Description |
HOST_URL | Domain for the ProcessMaker Platform instance. |
API_HOST |
API_TOKEN | Token a Script uses to authenticate to our API host. Note that this API token is only valid for the lifetime of the Script: after the Script runs and the Script Executor's Docker container from which that Script ran, its API token is no longer valid. |
Understand what a Script does in ProcessMaker Platform.
In ProcessMaker Platform, Scripts allow Process designers and developers to write self-contained programmatic actions that can be called from any Process at runtime. This enables the reuse of the same Script across multiple Process models. In other words, "write once, use anywhere."
Generate a Script using a natural language description of its function
Clean a Script to improve its code
Document a Script
Explain a Script
Note that Cornea AI features are only available when using Scripts in JavaScript or PHP programming languages.
See an example in the following video how ProcessMaker Platform integrates with third-party services Amazon Textract and UiPath Robotic Process Automation (RPA) so a loan application workflow scans, analyzes, and intelligently routes a Request and provision a bot accordingly.
Intended audience: Process designers and business analysts
Viewing time: 11 minutes; contains narration
ProcessMaker Platform supports the following programming languages in the Open-Source edition:
PHP
Lua
JavaScript
ProcessMaker Platform Enterprise edition supports the following additional programming languages:
C#
Java
Python
R
When the Script Executor creates a Docker container to run a Script, required libraries are already built in that Docker container. Furthermore, all default Script Executors that run ProcessMaker Platform-supported programming languages also contain the Software Development Kits (SDKs) for those languages.
See an example in the following video how to use a Script Executor that includes a Docker RUN command to package the Google Client class provided by Google into that Script Executor, thereby allowing Scripts using that Script Executor to successfully call the Google API.
Intended audience: Administrators, software developers, and coding engineers
Viewing time: 3 minutes; contains narration
While designing a Script, test it before you deploy it. Scripts are tested within the authoring environment to ensure they function as intended. While testing, do the following:
Incorporate other JSON-formatted data, such as API keys, to ensure your Script uses them correctly during your testing.
Follow these steps to view all Scripts in your organization:
Do one of the following:
The Scripts tab displays the following information in tabular format about Scripts:
Language: The Language column displays the programming language with which the Script was written.
ProcessMaker Platform instance API to which to make all calls.
More efficiently produce your Scripts with , Cornea AI. Use Cornea AI's no-coding option in the following ways to more efficiently produce Script assets:
Scripts run securely and in isolation from within containers called . The Script Executor for each supported programming language contains the Software Development Kit (SDK) that supports extensibility to provide programmatic interaction with ProcessMaker Platform. When the ProcessMaker Platform instance calls a Script to run, the Script Executor for that programming language creates a corresponding with that programming language, runs the Script, and then destroys the Docker container. This ensures that any malicious script that anyone in your organization might inadvertently introduce to ProcessMaker Platform does not affect the instance or its hosting environment: Docker containers cannot access them. Furthermore, Docker containers cannot listen for inbound connections; therefore, a Docker container cannot be accessed externally.
Scripts are designed and tested in the .
Use the JSON data model that you can to ensure that variables designed from a Screen function as intended in your Script.
See the permissions or ask your Administrator for assistance.
to ProcessMaker Platform.
Click the Designer option from the top menu. The displays.
From the Assets pane in the Designer Welcome Screen, mouse-hover over the Scripts icon, and then select View All Scripts.
Click the Scripts icon from the left sidebar. The Scripts tab displays all Scripts in the Scripts page.
Name: The Name column displays the name of the Script. Click the name to edit the Script in .
Description: The Description column displays the description of the Script. See for more information.
Category: The Category column displays to which the Script is assigned.
Modified: The Modified column displays the date and time the Script was last modified. The time zone setting to display the time is according to the ProcessMaker Platform instance unless your Time zone setting is specified.
Created: The Created column displays the date and time the Script was created. The time zone setting to display the time is according to the ProcessMaker Platform instance unless your Time zone setting is specified.
Use the setting to filter Scripts that display.
Click the +Script button. See .
Click the menu, and then select the Edit Script option or click the Script name. See .
Click the menu, and then select the Configure option. See .
Click the menu, and then select the Add to Project option. See .
Click the menu, and then select the Copy option. See .
Click the menu, and then select the Delete option. See .
, including how to sort columns or how many items display per page.
Click the Home breadcrumb icon to go to the .
Manage your Script Categories.
Use Script Categories to organize your Scripts. Organizing your Scripts into Categories makes it easier to search for a Script based on its assigned Category. Assign multiple Script Categories to a Script if necessary. For example, assign a Script named "Database Call" to the "Database Scripts" and "Data Management" Script Categories.
Script Categories can be in active or inactive status. Following is a description of each status:
Active: Active Script Categories can have Scripts assigned to them.
Inactive: Inactive Script Categories cannot have Scripts assigned to them.
Follow these steps to view Script Categories:
Log on to ProcessMaker Platform.
Click the Designer option from the top menu. The Designer Welcome Screen displays.
Click the Categories tab. The Script Categories display.
The Categories tab displays the following information in tabular format about Script Categories:
Name: The Name column displays the name of the Script Category. The Script Category named Uncategorized is the default Category.
Status: The Status column displays the status of the Script Category. Below is a description of each status:
Active: Active Script Categories can have Scripts assigned to them. The Script Category named Uncategorized is active by default.
Inactive: Inactive Script Categories cannot have Scripts assigned to them.
Scripts: The # Scripts column displays how many Scripts in your organization have been assigned to that Script Category.
Modified: The Modified column displays the date and time the Script Category was last modified. The time zone setting to display the time is according to the ProcessMaker Platform instance unless your user profile's Time zone setting is specified.
Created: The Created column displays the date and time the Script Category was created. The time zone setting to display the time is according to the ProcessMaker Platform instance unless your user profile's Time zone setting is specified.
If no Script Categories exist, the following message displays: No Results.
Use the Search setting to filter Script Categories by their names.
​Control how tabular information displays, including how to sort columns or how many items display per page.
Follow these steps to create a new Script Category:
Click the +Category button. The Create Script Category screen displays.
In the Category Name setting, enter the name of the new Script Category. The Script Category name must be unique from all other Script Category names in your organization and can only use apostrophe characters ('
) and spaces. This is a required setting.
From the Status drop-down menu, select one of the following options for the Script Category's status:
Active: Active Script Categories can have Scripts assigned to them.
Inactive: Inactive Script Categories cannot have Scripts assigned to them.
The Active option is selected by default. This is a required setting.
Click Save.
Follow these steps to search for Script Categories:
Enter in the Search setting the text to filter Script Categories by name.
As you enter text into the Search setting, Script Categories display that match your entered text.
If there are no search results, the following message displays: No Results.
Follow these steps to edit a Script Category:
Edit the following information about the Script Category as necessary:
In the Category Name setting, edit the name of the Script Category if necessary. The Script Category name must be unique from all other Script Category names in your organization. This is a required setting.
From the Status drop-down menu, change the status of the Script Category, if necessary, from the following options:
Active: Active Script Categories can have Scripts assigned to them.
Inactive: Inactive Script Categories cannot have Scripts assigned to them.
This is a required setting.
Click Save.
To delete a Script Category, no Scripts can be assigned to it. If any Scripts are assigned to the Script Category, its Delete Category option does not display. Reassign those Scripts to another Script Category.
Deleting a Script Category cannot be undone.
Follow these steps to delete a Script Category:
Click Confirm. The following message displays: The category was deleted.
Click the Scripts icon from the left sidebar. The Scripts tab displays all Scripts in the Scripts page.
Click the menu, and then select the Edit Category option for the Script Category to edit. The Edit Script Category page displays.
Click the menu, and then select the Delete Category option for the Script Category to delete. A message displays to confirm deletion of the Script Category.
Manage Scripts throughout your organization.
Use the Search function to filter all Scripts from the Scripts page based on your entered text.
Follow these steps to search for a Script:
View your Scripts. The Scripts page displays.
Enter in the Search setting the text to filter Scripts using any of the following criteria:
Name: Filter by the Script name that displays in the Name column.
Category: Filter by the Script Category name that displays in the Category column.
Description: Filter by the Script description that displays in the Description column.
As you enter text into the Search setting, Scripts display that match your entered text.
If there are no search results, the following message displays: No Results.
Follow these steps to edit a Script:
View your Scripts. The Scripts page displays.
Adding a Script to a Project adds that Process as an asset to that Project. Any Project member may then use that asset toward the goals of that Project.
Follow these steps to add a Script to a Project:
View your Scripts. The Scripts tab displays.
Optionally, select the Use a copy of this asset option to use a copy of this Script as the Project asset instead of the original. When selecting this option, any revisions made to the original Script do not affect yours in your Project(s), and vice versa. Consider this option a best practice to use, especially if you intend to make changes from the original Script that may not be an asset in any Project.
Click Add. The Script is added as an asset to the selected Project(s).
Follow these steps to copy a Script:
View your Scripts. The Scripts page displays.
Edit the following information from the original Script as necessary:
In the Name setting, edit the name of the copied Script. After the original Script is copied, the word Copy is suffixed to the original Script's name. This is a required setting.
In the Description setting, edit the description from the original Script.
Click Save.
When a Script is deleted, Process models that use that Script in Script Task elements are not affected. However, that Script can no longer be referenced from other Process models thereafter.
Deleting a Script from the Scripts page cannot be undone.
Follow these steps to delete a Script:
View your Scripts. The Scripts page displays.
Click Confirm.
Click the menu, and then select the Edit Script option for the Script to edit. The Script opens in Script Editor. See Script Editor.
Click the menu, and then select the Add to Project option. The Add to a Project screen displays.
From the Select Project drop-down, select to which Project(s) this Script becomes an asset. To remove a Project that is currently selected, click theicon for that selection or press Enter
when the drop-down is visible.
Click the menu, and then select the Copy option for your Script. The Copy Script screen displays.
Click the menu, and then select the Delete option for the Script to delete. The Caution screen displays to confirm the deletion of the Script.