previousAction()
Last updated 22/01/2025
The
In the previous chapter,
Multiple actions and functions are used to demonstrate returning back multiple actions. All the functions will be added first.
In this tutorial, the following will be performed to demonstrate how
- Add the ToProcessA()function - When on Process B, will select Process A usingselectAction().
- Add the ToProcessC()function - When on Process B, will select Process C usingselectAction().
- Add the Previous1()function - When on Process C, will return you to Process B usingpreviousAction().
- Add the Previous2()function - When on Process C, will return you to Process A usingpreviousAction()and passing in the optional number parameter.
- Edit the Process B record - To add the screen fields Back to Process A and To Process C, these fields will have a _Button display type and respectively will have the ToProcessA()andToProcessC()functions attached.
- Add the Process C record - With the screen fields Back One Action and Back Two Actions, these fields with have a _Button display type and respectively have the Previous1()andPrevious2()functions attached.
Add the ToProcessA Function
The
2. Select Functions in the sub-menu.
3. Click the Add Item button.
4. Type ToProcessA in the Function ID field.
5. Click in the Code field to open the Code Editor.
6. Copy and paste the code block below into the editor.
function ToProcessA(five, context, result) {
five.selectAction('ProcessA');
return five.success(result);
}
7. Click the Save button in the Code Editor app bar.
8. Click the Save button in the form app bar.
Add the ToProcessC Function
The
2. Type ToProcessC in the Caption field.
3. Click in the Code field to open the Code Editor.
4. Copy and paste the code block into the editor.
function ToProcessC(five, context, result) {
five.selectAction('ProcessC');
return five.success(result);
}
5. Click the Save button in the Code Editor app bar.
6. Click the Save button in the form app bar.
Add the Previous1 Function
The
2. Type Previous1 in the Function ID field.
3. Click in the Code field to open the Code Editor.
4. Copy and paste the code block below.
function Previous1(five, context, result) {
five.previousAction();
return five.success(result);
}
5. Click the Save button in the Code Editor app bar.
6. Click the Save button in the form app bar.
Add the Previous2 Function
The
2. Type Previous2 in the Function ID field.
3. Click in the Code field to open the Code Editor.
4. Copy and paste the code block below into the editor.
function Previous2(five, context, result) {
five.previousAction(true, 2);
return five.success(result);
}
5. Click the Save button in the Code Editor app bar.
6. Click the Save button in the form app bar.
Edit Process B
The Process B record that was added in the previous chapter,
2. Select Processes in the sub-menu.
3. Select the Process B record in the list.
4. Click the Screen Fields tab.
5. Click the Add Screen Fields button.
6. Type Back to Process A in the Caption field.
7. Click the lookup icon in the Display Type field and select _Button.
8. Click the Events tab.
9. Click the lookup icon in the On Click field and select ToProcessA.
10. Click the Save button in the form app bar.
11. Click the Add Screen fields button.
12. Type To Process C in the Caption field.
13. Click the lookup icon in the Display Type field and select _Button.
14. Click the Events tab.
15. Click the lookup icon in the On Click field and select ToProcessC.
16. Click the Save button in the form app bar.
17. Click the Save button in the form app bar above the list.
Create Process C
Process C will have two screen fields. The Back One Action field will have the
2. Type Process C in the Title field.
3. Click the Screen Fields tab.
4. Click the Add Screen fields button.
5. Type This is Process C in the Caption field.
6. Click the lookup icon in the Display Type field and select _Label.
7. Click the Save button in the form app bar.
8. Click the Add Screen Fields button.
9. Type Back One Action in the Caption field.
10. Click the lookup icon in the Display Type field and select _Button.
11. Click the events tab.
12. Click the lookup icon in the On Click field and select Previous1.
13. Click the Save button in the form app bar.
14. Click the Add Screen Fields button.
15. Type Back Two Actions in the Caption field.
16. Click the lookup icon in the Display Type field and select _Button.
17. Click the Events tab.
18. Click the lookup icon in the On Click field and select Previous2.
19. Click the Save button in the form app bar.
20. Click the Save button in the form app bar above the list.
How This Works in an Application
Lets see how all this works in the Action Navigation application. To begin with you are on Process A and if you click the To Process B button, you are navigated to Process B, this is because the ProcessB action ID is passed into
Once you are navigated to Process B, there are two buttons. If you click the Back to Process A button, you will be navigated to Process A, this is because the ProcessA action ID is passed into
Now you are back on Process A, click the To Process B button again to return to Process B.
This will once again take you to Process B. This time click the To Process C button, you will be navigated to Process C, this is because the ProcessC action ID is passed into
On Process C, there are two buttons, Back One Action and Back Two Actions. Clicking the Back One Action button will navigate you back to Process B. This is because in
Now you are back on Process B, click the To Process C button again to return to Process C.
This time click the Back Two Actions button, this will navigate you back to Process A. This is because
This all happens without leaving the Process A menu item.