Relogin User with Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 12:18 AM
Hi,
with GlideSessions.lockOutSessionsInAllNodes(user) im able to logout a User.
Is there an Option to logout and login again? <- with script
So that the user dont have to do the relogin manually?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 12:23 AM
I don't think it's a valid business requirement.
Why would you want a script to login for user?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 12:34 AM
Hi Ankur,
after a special Action of the User, we assign a Role to the User.
Unfortunatly, the User needs to logout and login again, to get the "function" of that new rule.
We would like to find a Solution, so that the User does not have to do any action by themself
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 01:45 AM
Hi @Meloper
Try this :
var user = gs.getUser();
// Refresh GlideSession object
GlideSecurityManager.get().setUser(user);
// Refresh GlideUser object
gs.getSession().loadUserByID(user.getID());
Refer below posts for reference :
https://www.servicenow.com/community/itsm-forum/glidesecuritymanager-and-service-portal/m-p/817608
https://github.com/zhmur/servicenow-guides/blob/master/Dirty%20hacks.md
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 02:08 AM
Wow, thank you, i will try it.
However i cant find this api in developer page: https://developer.servicenow.com/dev.do#!/reference/api/utah/server_legacy/