Displaying Confirmation Message in SOW View while closing the case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 04:59 AM
Currently, the confirmation message that appears when closing a case is only shown in the native view, not in the SOW view.
we want achieve UI page to confirm both the fields from case record while closing the case record we want populate those two fields in the confirmation message on click yes UI action will proceed and close the case if no abort the action and stays on the case record for the change of those fields. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 05:12 AM
Hi,
You can use g_modal API to display a modal window in workspace.
Go to System definition -> UI action
Open the UI action and make sure these checkboxes are checked
Use g_modal API in workspace client script
Reference - https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev_portal/API_referenc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 11:11 PM
Hi ,
UI Page:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 05:15 AM
Did you add script to workspace client script section of your UI action.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 05:46 AM
You can make your UI action as client side and ensure Onclick function is given
For native: script will be like this, I took example of OOTB "Close Task" button on sc_task
function closeTask() {
var dialog = new GlideModal('glide_modal_confirm', true, 300);
dialog.setTitle('Confirmation');
dialog.setPreference('body', 'Are you sure?'); // here you can pass the form field value in body by accessing using g_form.getValue('fieldName')
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
function doComplete() {
g_form.setValue('state', 3);
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'close_sc_task');
}
function doCancel() {
callback(false);
}
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
updateTask();
function updateTask() {
current.state = 3;
current.update();
}
For SOW -> use g_modal confirm API
function onClick(g_form) {
var msg = getMessage("Are you sure you?"); // here you can pass the form field value in body by accessing using g_form.getValue('fieldName')
g_modal.confirm(getMessage("Confirmation"), msg, function(confirmed) {
if (confirmed) {
g_form.setValue('state', 'closed_complete');
g_form.save();
}
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader