Generate Your Script Using AI Assistant

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:

Create an array of all U.S. states, arranged in alphabetical order, where each state has an ID matching its position in the array.

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.

Language Support

This feature is available only when creating a Script in JavaScript or PHP.

Watch the following product tour to learn how to use AI to assist you in script generation.

Generate a Script From Text

Permissions

Your user account or group membership must have the following permissions to generate a Script using natural language:

  • Scripts: View Scripts

  • Scripts: Create Scripts

  • Scripts: Edit Scripts

See the Scripts permissions or ask your Administrator for assistance.

Follow these steps to generate a Script using a natural language description of its function:

  1. While in Script Editor, expand the AI Assistant panel.

    The AI Assistant features display.

    AI Assistant for Scripts in Script Editor

  2. Click the Generate Script From Text option. The Generate Script From Text panel displays.

    Generate Script From text panel in Script Editor

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

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

  5. Click the Generate button. The Before you continue screen displays.

    Ensure the cursor is positioned where you intend to place the generated script

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

        Comparing the current script against the AI generated script

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

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.

Permissions

Your user account or group membership must have the following permissions to clean a Script:

  • Scripts: View Scripts

  • Scripts: Create Scripts

  • Scripts: Edit Scripts

See the Scripts permissions or ask your Administrator for assistance.

Follow these steps to use AI Assistant to clean a Script:

  1. Edit a Script in which to clean.

  2. Expand the AI Assistant panel. The AI Assistant features display.

    Cornea AI assistant for Scripts in Script Editor

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

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

Document a Script

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.

Permissions

Your user account or group membership must have the following permissions to document a Script:

  • Scripts: View Scripts

  • Scripts: Create Scripts

  • Scripts: Edit Scripts

See the Scripts permissions or ask your Administrator for assistance.

Follow these steps to use AI Assistant to document a Script:

  1. Generate or edit a Script to document.

  2. Expand the AI Assistant panel. The AI Assistant features display.

    Cornea AI assistant for Scripts in Script Editor

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

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

Explain How a Script Functions

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.

Permissions

Your user account or group membership must have the following permissions to explain a Script:

  • Scripts: View Scripts

  • Scripts: Create Scripts

  • Scripts: Edit Scripts

See the Scripts permissions or ask your Administrator for assistance.

Follow these steps to use AI Assistant to explain how a Script functions:

  1. Edit a Script in which to explain how it functions.

  2. Expand the AI Assistant panel. The AI Assistant features display.

    Cornea AI assistant for Scripts in Script Editor

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