how to load and call the javascript file into servicenow business rule

subrata_mettle
Kilo Contributor

Hi ,

From My Application I have written 3 JavaScripts files which used to call a Rest API.

I wanted to call the same Rest API from ServiceNow Through Some Business Rules so that I dont have to write the Code again.

What is the way to use the same javascripts file in my Business Rules.

Thanks and Regards,

Subrata

7 REPLIES 7

Jeff Boltz1
Mega Guru

The SN Nerd
Giga Sage
Giga Sage

JS files and Busines Rule 'JavaScript' are two very different things.



JS files are client-side JavaScript, used to manipulate HTML pages, which is run from within a web browser.



Business Rules are run server side, which uses ServiceNow's Server Side API, that uses the same syntax as JavaScript.


While most (not all) JavaScript objects and methods are available in Business Rules, you do not have access to the DOM (ie window, document) as it is not run on a page.


All code is interpreted and executed as Java on the Server.



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

vionservicenow
Tera Contributor

Thank you but what is the solution now? We need to run the javascript within the client side browser.