How to pass arguments to a script include and call it from a business rule

bonsai
Mega Sage

I created a client-callable script in a script include.

I want this script to be a common script that can be called from business rules as well as client scripts.

When passing arguments from the client script to the script include, set the following code to the script include,
"var para_1 = this.getParameter('para_1');"

I was passing the arguments with the below code from the client script.
"ga.addParam('para_1', ”ABC”);"


When passing arguments from the server script, is it necessary to pass the value by specifying the argument like the client script?

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

In client script, you pass it as parameters as you've mentioned.

In server script, the client callable script include method you're using would need to be slightly adjusted to also work for server script...see this thread for an example: https://community.servicenow.com/community?id=community_question&sys_id=e15f51d91b2800d4d01143f6fe4b...

Otherwise, client callable script includes won't work the same as a server script include. They're different.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

4 REPLIES 4

Mohith Devatte
Tera Sage
Tera Sage

Hello no its not necessary like client script 

you can do like below

new your_scrip_include_name().your_function_name(your parameter)

pass  your parameter in the function 

mark my answer correct if it helps you

Allen Andreas
Administrator
Administrator

Hello,

In client script, you pass it as parameters as you've mentioned.

In server script, the client callable script include method you're using would need to be slightly adjusted to also work for server script...see this thread for an example: https://community.servicenow.com/community?id=community_question&sys_id=e15f51d91b2800d4d01143f6fe4b...

Otherwise, client callable script includes won't work the same as a server script include. They're different.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

thank you!

Moises Shepherd
Kilo Explorer

Hi, Really impressive discussion. As we have client-callable script for palm harbor fl homes. But from the last few days the script is showing issue. Where will I find the expert for it to fixed it. I have tried mybest. But not finding the exact solution.