Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Testing GlideAjax class from background script

Giri6
Tera Expert

If I have script include MyClass wich clicent callable with method  myFunction and if I pass  'sysparm_number' and 'sysparm_user', what is the code that I can put in background script to test? Appreciate it.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to check the value of the parameter

you can make the function as both client callable with sysparm_number or passing the function parameter

getIncidents: function(number1){

var number = JSUtil.nil(number1) ? this.getParameter('sysparm_number') : number1;

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

If you cannot modify existing script, then just add a new function in the same SI and call that SI from background script and check it.

In that newly added funciton, you can remove this.getParameter lines.

Mark the comment as a correct answer if this has answered you question. This will take the question off from the unsolved list.

Hi Giri,

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader