Form - UI Actions:
User Story/Scenario:
For Approvers:
You have a module called 'Pending for My Approval' displaying a list of records from the "IT Support Orders" custom table.
This table "IT Support Orders" have a field called "Status" which holds two choices Approved and Rejected.
You can open any existing record which is pending for approval.
You as Approver, you should be able to approve or reject the record by clicking on Approve or Reject UI Actions from form banner.
Approve Action:
Clicking the "Approve" button in the form banner changes the status/state of the currently opened records to "Approved."
Reject Action:
Clicking the "Reject" button in the form banner changes the status/state of the currently opened records to "Rejected."
In summary, as an approver, you can use the 'Pending for My Approval' module to review records awaiting your approval. Open any specific record and click Approve or Reject UI action from Form banner to approve or reject opened record with corresponding buttons in the Form banner.
Development Process:
Role required: admin
Requirement in detail : We have to create two UI actions in "IT Support Orders" table form.
Approve
Reject
Approve UI Action:
Steps:
Go to "IT Support Orders" table list view.
Open any record > Right click on form banner > go to Configure > UI Action
Click New, and provide the below details in new UI Action to create Approve UI action on Form.
Name : Approve
Table : IT Support Orders // Provide your table name here
Order : 300
Action Name : approve
Active : True
Show Insert : False
Show update : True
Form button : True
Condition : current.canWrite();
Script :
current.u_state = 'approved'; // In State field choices, Approved choice value should be approved.
current.update(); // Update the selected record.
action.setRedirectURL(current); // Stay in same page after updating the current record.
gs.addInfoMessage('Approved successfully');
Click Submit.
Now go to the table list, which we used in above steps (ex: IT Support Orders), and open any record now we will be able to see the Approve UI action in Form banner.
Reject UI Action:
Steps:
Go to "IT Support Orders" table list view.
Open any record > Right click on form banner > go to Configure > UI Action
Click New, and provide the below details in new UI Action to create Reject UI action on Form.
Name : Reject
Table : IT Support Orders // Provide your table name here
Order : 400
Action Name : reject
Active : True
Show Insert : False
Show update : True
Form button : True
Condition : current.canWrite();
Script :
current.u_state = 'rejected'; // In State field choices, Rejected choice value should be rejected.
current.update(); // Update the selected record.
action.setRedirectURL(current); // Stay in same page after updating the current record.
gs.addInfoMessage('Rejected successfully');
Click Submit.
Now go to the table list, which we used in above steps (ex: IT Support Orders), and open any record now we will be able to see the Reject UI action in Form banner.
Refer the below screenshots for more information on creating UI Actions as mentioned above: