Cancle and OK button in Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 12:59 AM
hi,
i need to add alert with Cancel and Ok button on change of state on incident table.
please suggest on implementing confirmation , via Business rule.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 01:03 AM
HI @Ujjwal1 ,
You can achieve it via client script. Business rule runs at server end so we can not alert it.
Use below code in onchange client script on state.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == oldValue) {
return;
}
var answer = confirm("Are you sure you want to change the state?");
if (!answer) {
// If user clicks "Cancel", revert to the previous value
g_form.setValue('state', oldValue);
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 01:04 AM
@Ujjwal1 - BR is for server scripting what you asking is more towards client side scripting so you would need to create a onsubmit client script.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.