Zurich pop-up after user login with last login time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello community,
I have been reviewing internet info buy actually I cannot activate a pop-up with the last login time (one per session), after user successful login. I have used client scripts, UI script, ...
The codes I have found are not working and if I run a "run point scan" I can see that GlideEncrypter, GlideCryptoService API and Encrypted API are deprecated.
Please, would anyone to be so kind to support me on how can achive this config that works in the actual and next Servicenow versions?
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
49m ago
Check if you are looking for this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
43m ago
Hi @Sergio Ibanez,
as per the official docs GlideEncrypter - Global (deprecated) it is recommended to proceed with Key management Framework to encrypt
let me know if it covers your question, the screenshot is not possible to read..
100 % GlideFather experience and 0 % generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7m ago
This requirement doesn’t need any of the deprecated APIs like GlideEncrypter or GlideCryptoService.
You can achieve it using the last_login_time field from sys_user and a small session-based check.
- Get last login time
- The value is already available in
sys_user.last_login_time
2. Show popup only once per session
Script Include (Client Callable)
var GetLastLogin = Class.create();
GetLastLogin.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getLastLogin: function() {
var user = gs.getUserID();
// Check session flag
if (gs.getSession().getProperty('shown_last_login') == 'true') {
return '';
}
gs.getSession().putProperty('shown_last_login', 'true');
var gr = new GlideRecord('sys_user');
if (gr.get(user)) {
return gr.last_login_time.getDisplayValue();
}
return '';
}
});
Client Script (e.g., onLoad in UI / Portal)
var ga = new GlideAjax('GetLastLogin');
ga.addParam('sysparm_name', 'getLastLogin');
ga.getXMLAnswer(function(response) {
if (response) {
alert("Your last login was on: " + response);
}
});- This ensures the popup shows only once per session
- No dependency on deprecated APIs
