can you call a business rule through a client script? it's call through glide ajax ,but i need example?

ram2497
Tera Contributor

can you call a business rule through a client script?  it's call through glide ajax ,but i need example?

1 ACCEPTED SOLUTION

The SN Nerd
Giga Sage
Giga Sage

Anytime you need to re-use a Business Rule, you should abstract the Script and Condition (depending on it's complexit) into a Script Include.

If you want to call the Script Include on a Client Script, you then need that Script Include to extend AbstractAjaxProcessor.

This will allow you to call it via GlideAjax in the Client Script.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

3 REPLIES 3

Monika2
Giga Guru

Hi Ram,

You cannot call business rule through client script. You can only get the scratchpad value through display business rule.

If you want to call server side script through client side you need to write script include and then call it through GlideAjax.

 

Hope it helps.

 

Warm Regards,

Monika Ashtewar

find_real_file.png

www.dxsherpa.com

 

Tushar Sharma2
Kilo Guru

Hello Ram,

Check out below docs page for an example how to call script include using ajax from client script.

Examples of asynchronous GlideAjax

 find_real_file.png

Register Now

www.DxSherpa.com

The SN Nerd
Giga Sage
Giga Sage

Anytime you need to re-use a Business Rule, you should abstract the Script and Condition (depending on it's complexit) into a Script Include.

If you want to call the Script Include on a Client Script, you then need that Script Include to extend AbstractAjaxProcessor.

This will allow you to call it via GlideAjax in the Client Script.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022