Confirm message using a business rule

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2019 12:42 PM
Hello!
Has anyone ever generated a Pop up message using a business rule? I understand within the form view we can use on submit scripts or modify UI actions but I need this to show up in the list view as well. A before query business rule will work but it only adds infomessages or errormessages. I need the user to click to the disclaimer message.
Thanks!
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2019 01:17 PM
Use this in a business rule.. Tried and tested
var msg='haha';
gs.addErrorMessage('<script>var t=setTimeout(function(){var test = confirm("' + msg + '");if(!test){return false;}},500);</script>' + msg);
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2019 01:38 PM
Hi Nitesh,
You can use the below code to add confirm message in your business rule:
var conf = confirm("Please enter the text which you want use in here for confirmation");
if(conf== true){
//do something
}
else{
return false;
}
Please mark this correct if it resolves the issue and helpful too if it helped you at all.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2024 01:09 AM
Hello Mohit,
The confirm() function is part of JavaScript's client-side behavior, and cannot be used in a Business Rule in ServiceNow. Business Rules run on the server, so they can't show prompts or dialogs to the user. We may need to split the logic between Client and Server such as a Client Script and a BR.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2019 09:20 AM
They didn't really work for me, our requirement changed in the end. Thank you though!