gs.isInteractive() always returning false, even in a Background script

Jamison Cote2
Mega Expert

Pretty simple question & I must be missing something simple here.

Both: 

gs.isInteractive() 

gs.getSession().isInteractive()

Return 'false' when run in a background script. Isn't the whole purpose of these to determine if the user is in an active session in ServiceNow?

Running:

gs.print(gs.isInteractive());

Prints as false in a background script.

Any idea what needs to change here?

Thanks. 

6 REPLIES 6

Willem
Giga Sage
Giga Sage

Background script is not considered to be interactive.

 

If you use it in for example a Business rule, it will return True:

find_real_file.png

 

find_real_file.png

 

 

 

@Jamison Cote where you able to check this answer?

If so, can you please mark Correct? This will close the thread and makes the answer easier to find for others.

Sajilal
Mega Sage

Try it in a business rule rather a Background Script.

Thanks,

Saji