Calling script include answer

josh_brostoff
Giga Contributor

I have a script I want to execute depending on if the answer for a script include returns true or false.   I invoke the script include at the beginning of my script and want to add if "if/else" statement to decide wether or not the script should execute.   How can I do this?

(Script I want to execute if script include returns true)

Screen Shot 2017-01-23 at 5.52.44 PM.png

(Script include)

Screen Shot 2017-01-23 at 5.52.31 PM.png

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Josh,



var slack = new SlackUser();


var res = slack.activeUser(); //This would return true or false depeding on the output from Script include.



Please let me know if you have any questions.


View solution in original post

5 REPLIES 5

The SN Nerd
Giga Sage
Giga Sage

Line 13 to 21 in your code is not necessary.


Consider simplifying:



gr.query();


return gr.hasNext();



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