- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 08:59 AM
I'm thinking of doing a few things when a user logs in.
So I'm looking into ways of how to trigger this. I found this Help the Helpdesk - run when logging into ServiceNow
which seems pretty straight forwards and isn't many line of code to get it to work.
So I created a global ui script to test, but I cant get it to work. can anyone explain why or have any other idea how to make something run when user logs on?
This is my code, pretty much copied from the above thread.
CustomEvent.observe('user.login', test);
function test() {
alert("CAN YOU FEEL IT!");
}
And nada happens.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 01:34 PM
I found a way to do it.
When this inside a global ui script I get the "alert".
addLoadEvent( function() {
if(window.frameElement){
if(window.frameElement.id == 'gsft_main'){
alert("Working?");
}
}
})
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 10:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 10:56 AM
H Jamie,
You're right, I might need to say about what I'm wanting to do 😃
When user logs on, my script will check the user preferences, and if the correct value is there I think I will want a GlideDialogWindow will popup, haven't really decided what..
But for the sake of the case. Just lets say I want a popup window to show when user logs on =). If I can get this to work, I'll get the the rest later, but this is kind of a show stopper

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 11:50 AM
Hi Goran,
It's not very intuitive, but I think the place you need to look is called "Installation Exits". There is a Login script in there that you can work with.
It's server-side, so you'll have to work out how you want to pass the values, maybe add to the client session data and then react to that with a client script somewhere of your choosing.
Good luck,
-Brian
Edit: if you choose a business rule, I'd look at doing it on the sessions table at insert rather than on the user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2016 12:40 PM
Well, my problem is mainly how do I trigger it to happen "client side" directly after the user have logged in? how do I make a client script to hit on navpage.do?