gs.isInteractive() always returning false, even in a Background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 01:26 PM
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.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2020 11:14 PM
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2020 02:45 PM