- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2015 09:56 PM
Hi
My requirement is:
When user logged in for the 1st time, immediately that user must be navigated to users page ( as attached) so that he/she can fill their particular details. But from the 2nd time they should see their homepage. How to do that ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2015 02:22 AM
Hi Sneha,
please find below the complete solution. first make script include like below. it is assumed that if user Is new it will not have las login time field filled. it will be empty and for old users it will be always there. make sure no one can edit this field manually.
isnewuser : function () {
var userID = this.getParameter('sysparm_id');
var gr = new GlideRecord('sys_user');
gr.get(userID);
return gr.last_login_time.getDisplayValue();
},
it looks like this.
then make one global UI script.
addLoadEvent(newuserpage);
function newuserpage(){
if(window.GlideAjax && window.jQuery){
var userID = window.NOW.user.id;
var glide = new window.GlideAjax('getUser');
glide.addParam('sysparm_name', 'isnewuser');
glide.addParam('sysparm_id', userID);
glide.getXMLWait();
if(glide.getAnswer() == ''){
$j('#gsft_main').attr('src','https://yourinstance.service-now.com/sys_user.do?sys_id=' +userID );
}
}
}
it will look like this
let me know if u have any questions.
(mark helpful/correct/like if it helps)
Regards,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2015 10:58 PM
Hi Sneha,
you can make Script Action on event login... then you can make one custom field on user table ...it will have login counts. if it is 0 then redirect to user form else default home page.
else you can check last login field on user table..if it is blank that means user is logging in first time so redirect them to user form
let me know if u have any questions
regards,
Rushit PAtel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2015 11:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2015 02:22 AM
Hi Sneha,
please find below the complete solution. first make script include like below. it is assumed that if user Is new it will not have las login time field filled. it will be empty and for old users it will be always there. make sure no one can edit this field manually.
isnewuser : function () {
var userID = this.getParameter('sysparm_id');
var gr = new GlideRecord('sys_user');
gr.get(userID);
return gr.last_login_time.getDisplayValue();
},
it looks like this.
then make one global UI script.
addLoadEvent(newuserpage);
function newuserpage(){
if(window.GlideAjax && window.jQuery){
var userID = window.NOW.user.id;
var glide = new window.GlideAjax('getUser');
glide.addParam('sysparm_name', 'isnewuser');
glide.addParam('sysparm_id', userID);
glide.getXMLWait();
if(glide.getAnswer() == ''){
$j('#gsft_main').attr('src','https://yourinstance.service-now.com/sys_user.do?sys_id=' +userID );
}
}
}
it will look like this
let me know if u have any questions.
(mark helpful/correct/like if it helps)
Regards,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2015 03:28 AM
Hi Rushit,
That was so helpful and it is working
Thank you