# Parameters

## Parameters tab

### Required parameters list

| Columns   | Remarks                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------------------ |
| Parameter | Name of the application or sub-process parameter required by the action; a link displays the parameter form in edit mode |
| Direction | Parameter direction                                                                                                      |
| Value     | Process data associated to the parameter; a link displays the parameter form in edit mode                                |

### Additional parameters list

| Columns   | Remarks                                                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Parameter | <p>Parameter name; a link displays the parameter form in edit mode</p><p></p><p>The <strong>Add</strong> link displays a blank parameter form to add new data.</p> |
| Direction | Parameter direction                                                                                                                                                |
| Value     | Data associated to the parameter                                                                                                                                   |
| Deletion  | Clicking **`x`** deletes the parameter                                                                                                                             |

### Invalid parameters list

If there are parameters that are no longer required by the selected sub-process, they become invalid and will appear in this list and can be deleted manually.

## Parameter editing screen

| Fields                 | Remarks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Parameter              | <p>Unique identifier for the parameter; must respect nomenclature and be limited to 30 characters (required field)</p><p></p><p>Application parameters such as <code>FORM\_FIELDS\_READONLY</code> are available through the <strong>Other parameters</strong> button. This is commonly associated with the name/ID of the form field.</p><p></p><p>✏️ <strong>Note:</strong> Parameter names should respect the following XML naming rules:</p><ul><li>They should begin with a letter or an underscore</li><li>They should contain only letters, digits, hyphens, underscores, and periods</li><li>They should not contain spaces</li><li>They should not begin with the letters <code>XML</code> in any case (e.g. <code>xml</code> or <code>Xml</code>)</li></ul><p>For more information, see <a href="https://www.w3schools.com/xml/xml_elements.asp"><https://www.w3schools.com/xml/xml_elements.asp></a>.</p> |
| Browse                 | This button is only visible for actions that have at least one default application parameter defined                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Direction              | <p>Parameter direction:</p><ul><li><strong>IN</strong>: When the action is instantiated, the value of the parameter is initialized with a text, or the value of a macro or process data.</li><li><strong>OUT</strong>: When the action is being closed, the value of the parameter is stored in a process data value.</li><li><strong>INOUT</strong>: When the action is instantiated, the value of the parameter is initialized with a text, or the value of a macro or process data, and then, when the action is being closed, the value of the parameter is stored in a process data value.</li></ul>                                                                                                                                                                                                                                                                                                            |
| Send the value of      | The **IN** value to send to the parameter Depending on the type of data to be associated, this value can be process data, a macro or a freeform text value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Receive the value into | The process data where the **OUT** value of the parameter is stored                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Save button            | Save changes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Save and close button  | Save changes and close the screen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Add button             | Save the current parameter and display a blank form to add a new parameter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Delete button          | Allow the deletion of the current parameter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Close button           | Close the screen without saving                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

## Editing parameter expressions

WorkflowGen supports VBScript and JavaScript expressions in action parameters, which can be created either directly as action parameter values, or in TEXT type process data mapped to action parameters as IN values.

### **Creating an expression as an action parameter value**

1. Under **Send the value of** in the **Edit parameter** panel, choose **a text** and place the expression in the text area.<br>
2. Next to **Scripting**, check **Enable**, then choose either **JavaScript** or **VBScript**.

### **Creating an expression as a TEXT process data**

1. In the **Edit data** panel, place the expression in the **Default value** text area.<br>

   **Tip:** Click the pencil icon next to the **Default value** text area to open a larger text editor that includes JavaScript and VBScript syntax highlighting.<br>
2. Specify the language either on the **Mapping** tab in the Form Designer, or in the **Edit parameter** panel:<br>
   * In the **Edit parameter** panel, check **Enable** next to **Scripting**, then choose either **JavaScript** or **VBScript**.<br>

     **OR**<br>
   * On the **Mapping** tab in the Form Designer, choose the data's **Value IN** button, select the expression from the **Data** drop-down list, check **Enable** next to **Scripting**, then choose either **JavaScript** or **VBScript**.

All WorkflowGen macros (except notification macros) are fully supported in both languages and are enclosed by `< >`(e.g. `<WF_PROCESS_INST_ID>` for the request number).

In both languages, the expected result must be either a number, a string, or a date.

### **Examples**

This example would return the request number plus 5 in both JavaScript and VBScript:

```
<WF_PROCESS_INST_ID> + 5
```

{% hint style="info" %}
No `return` keyword is needed for expressions, with the exception of JavaScript inside a function. However, you cannot directly return the function; instead, it must be invoked and must return something like the following example, which would get tomorrow's date:

```
(function(){
    var today = <WF_SYSTEM_DATE>;
    var tomorrow = new Date();
    tomorrow.setDate(today.getDate()+1);
    return tomorrow;
})();
```

**OR**

```
function test(){
    var today = <WF_SYSTEM_DATE>;
    var tomorrow = new Date();
    tomorrow.setDate(today.getDate()+1);
    return tomorrow;
}
test();
```

{% endhint %}
