Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 02:01 AM - edited 04-29-2024 02:01 AM
Hi @harry24 ,
- Create a new UI Action:
- Go to the Form Layout for the record you want to modify (such as the Incident or Request form)
- Click on the UI Actions related link
- Click on New to create a new UI Action
- Configure the UI Action:
- Set the Name of the UI Action, such as "Cancel with Reason"
- Set the Table to the record type you want to modify (such as Incident or Request)
- Set the Action Name to "Cancel"
- In the Script field, enter the following code:
if (confirm('Are you sure you want to cancel this record?')) {
var reason = prompt('Please enter a cancellation reason:');
if (reason) {
g_form.setValue('work_notes', reason);
gsftSubmit(null, g_form.getFormElement(), 'cancel');
} else {
alert('A cancellation reason is required.');
}
}
This code will display a confirmation dialog when the Cancel button is clicked, and prompt the user to enter a cancellation reason in a pop-up dialog. If the user enters a reason, the reason will be set as the value of the work_b otes field (which is the work notes field for some record types), and the record will be cancelled. If the user does not enter a reason, an alert message will be displayed.
- Save the UI Action and test it on the form.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....