- 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 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 02:06 PM
This is handy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2016 02:30 PM
Just be careful and use more conditions and this: if(window.frameElement.id == 'gsft_main'){
otherwise it will hit like everywhere and even in some cms pages 😃
I'll throw in here my idea when Im done with it 😃
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2017 07:15 AM
Hi Goran - I'm trying to do something similar, that is, popup a message when a non-admin user logs into a non-production instance. It has to be modal, but it just needs to be very simple, exactly like an alert. I came across your post, but I need to know what conditions to use so this will only popup on login. Do you know what those might be?
Thanks,
-Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2017 11:04 AM
Hi Andy,
This is a tricky one. There is thou a None documented feature called "broadcast". Take a look at the table "broadcast message" and it pretty self explaining. But it's undocumented, so it's pretty much unknown territory and it might go away as well. Otherwise I guess you need to do some check like if the event for login just came in for the user and then show the modal. And perhaps use user preference to make that a user has seen it
You can also take a look at the overview (System UI->Overview Help) which you find in the navigator if that will help you.
