Confirm message using a business rule

Nitesh Balusu
Giga Guru

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!

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

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

Mohit Kaushik
Mega Sage
Mega Sage

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

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

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.

Nitesh Balusu
Giga Guru

They didn't really work for me, our requirement changed in the end. Thank you though!