
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2019 01:34 AM
I'm working on a Slack integration where the person who submitted the request is notified when comments are added to a task. (Comments on the Task are "bubbled" up to the RITM and REQ)
Since I don't want send a Slack notification for every comment added, I was thinking about checking to see if the requestor is already logged in; of which I will not send a Slack notification.
I've tried impersonation of the requestor in Dev to to check if to see if my methods are correct in detecting if the user is logged in, but it only generates a session under the my account.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 11:38 PM
John Heal, thanks for chiming in.
Since I created a business rule that triggers when a comment is added, I needed to know if the "requestor" was logged in, when the "assigned_to" person added a task comment. So using isLoggedIn() would not help if needed to know if the "requestor" was logged into ServiceNow, when the business rule was running under the context of the assigned_to.
I ended up checking if the requestor had a valid session. Seems to work; haven't gotten any complaints about users receiving too many Slack notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2019 03:25 AM
The function for checking if a users is logged in is
isLoggedIn()
Determines if the current user is currently logged in.
Type | Description |
---|---|
Boolean | True if the current user is logged in, false otherwise. |
To use the isLoggedIn() method in a scoped application, use the corresponding scoped method: isLoggedIn().
If you are querying how you check this in dev would any of the following work i your instance
- Set up a dummy user and run your check against that user.
- Run the check by passing in your own logged in user.
- Ask a colleague to log in with their account and pass them into your function
- Run your code through background script and pass in a user you know is logged in
Please mark as answered if the above helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 11:38 PM
John Heal, thanks for chiming in.
Since I created a business rule that triggers when a comment is added, I needed to know if the "requestor" was logged in, when the "assigned_to" person added a task comment. So using isLoggedIn() would not help if needed to know if the "requestor" was logged into ServiceNow, when the business rule was running under the context of the assigned_to.
I ended up checking if the requestor had a valid session. Seems to work; haven't gotten any complaints about users receiving too many Slack notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2020 11:53 AM
Hi,
could you please share, how you checked if requester had valid session. I have a requirement where I am getting a session id of user and I am suppose to check if its valid.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2021 05:12 AM
Hi Kristoffer,
Could you please guide us how to check if a specific user has a valid session ID?
Thanks!