- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-08-2020 06:44 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-08-2020 06:49 AM
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
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-08-2020 08:53 AM
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 as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2020 07:58 AM
Mark the comment as a correct answer if this has answered you question. This will take the question off from the unsolved list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-09-2020 11:48 PM
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
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader