Action Buttons
Last updated 26/03/2024
When you add a process, by default it will have no action buttons. You can add the following buttons to a process:
- Five's Cancel button
- Five's Run button
- Your own custom action button
Add Five's Cancel Button
By default, if there is no function attached to the On Cancel event, there will be no Cancel button on your process. If a function is attached to the On Cancel event, a Cancel button will be added to your process.
A function just using Five's default template supplied in the Code Editor will add a Cancel button on your process.
1. Navigate to the Functions view by selecting Logic in the menu and Functions in the sub-menu.
2. Click the Add Item button, give your function an ID, and click in the Code field to open the Code Editor.

3. Click the Save button in the Code Editor app bar.

4. Click the Save button in the form app bar.

5. Navigate to the Processes view by selecting Tasks in the menu and Processes in the sub-menu.

6. Select your process record in the list and click the Events tab.

7. Click the lookup icon in the On Cancel field and select your function.

8. Click the Save button.

A Cancel button will be added to your process.

Data can be entered into the screen fields.

When the Cancel button is clicked, all the fields will be cleared.

Of course you can add more functionality to your Cancel button if required. An example of this is in the function below.
function Cancel(five, context, result) {
five.showMessage('Your form has been cleared');
return five.success();
}
With the function attached to the On Cancel event when the Cancel button is clicked, all fields are cleared and a message will be shown in the UI.

Add Five's Run Button
By default, if there is no function attached to the On Run or the Do Run events, there will be no Run button on your process. If a function is attached to the On Run or the Do Run events, a Run (tick) button will be added to your process. When the button is clicked your process will run and your function will be executed.
1. Navigate to the Functions view by selecting Logic in the menu and Functions in the sub-menu.
2. Click the Add Item button, give your function an ID, and click in the Code field to open the Code Editor.

3. Add your code and click the Save button in the Code Editor app bar.

4. Click the Save button in the form app bar.

5. Navigate to the Processes view by selecting Tasks in the menu and Processes in the sub-menu.

6. Select your process record in the list and click the Events tab.

7. Click the lookup icon in one of the Run fields and select your function.

8. Click the Save button in the form app bar.

A Run button will be added to your process.

When the Run button is clicked the process will run unless an error is created which will cause the proces to be unsuccessful.
