Is it possible to call a client script from Business Rule?

prasanna11
Mega Guru

I run into a requirement where a server side action (a delete operation) needs to happen based upon confirmation from user. (A promp Box)

Is it possible to call a client script from a before delete business rule. And proceed based upon the user response on a prompt box.!?

* I have a related list of records in a custom form . Users can click Mark delete icon (highlighted). And then "Save" the form which in turn is deleting the record.But we now need a prompt box before deleting.

find_real_file.png

Any leads will be helpful.

4 REPLIES 4

Mike Allen
Mega Sage

I would go the other way.   I would create a UI Action that is a client called, that prompts the confirm box up and does a current.deleteRecord() or something like that.   I don't think you can call both client and business rules in the same script outside of GlideAJAX.


Deepa Srivastav
Kilo Sage

Check below:-



How do i call client scripts after executing the business rule in a table?



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Thanks,
Deepa


zica
Giga Guru

Prasanna,



What could be done is using the script include which also runs on the server side like the business rule.


in your case you can display a confirmation message and depending the user action, you can call the script include and achieve the task.


Here are two posts that explain how script include and client script interacts :


Script Includes - ServiceNow Wiki


GlideAjax - ServiceNow Wiki


But clicking the "Mark delete" cross in the related list isn't an action which can trigger a client script. So that i can glideajax to script include and return.