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

asifnoor
Kilo Patron

Hi,

Refer to the below notes provided by SN.

An interactive session is one that involves an end-user interacting with a user interface that then retrieves information from a server. An example of this type of session is when a user logs in using the log-in screen or uses a form to query a data store. A non-interactive session is one that only involves programmatic interaction with a server such as a SOAP request to retrieve data.

Ref: https://developer.servicenow.com/dev.do#!/reference/api/orlando/server_legacy/c_GlideSessionAPI#r_Gl...

Based on this background script will return false and that is correct. 

Kindly mark the comment as a correct answer and helpful if this answers your question.

Willem
Giga Sage
Giga Sage

@Jamison Cote Please let us know if your question is answered by marking Correct. If it is not solved, please let us know how we can help.