- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 04:05 AM
Hi All,
I have a requirement, based on user subregion ess portal page will appear i.e when we click on a UI button first it check the user subregion and redirects to that specific ESS portal page. How to do it please any one help me.
Regards,
Nagaraju
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 04:16 AM
From UI Action, you can always query server side GlideRecord script -
var userId = gs.getUserID();
var grUser = new GlideRecord('sys_user');
if(grUser.get(userId)){
var userRegion = grUser.region;
//you can use userRegion here
}
An example UI action with gliderecord query in out of box -
Mark if it is helpful or correct, feedback is appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 04:08 AM
In the UI Action, you can access the User's subregion by quering the sys_user table using gs.getUserID();
And can redirect to any url with the below line -
action.setRedirectURL('http://www.mysite.com/mypage.htm');
Hopefully you have explored this option -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 04:12 AM
Hi srikanth,
Thanks for your information.
I got the user id, but how I get user subregion.
Regards,
Nagaraju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 04:21 AM
Nagaruaju,
Gliderecord the sys_user table with the sys_id of the current user logged in. From there you can retrieve the subregion value
sample of the script :
var currentUser = gs.getUserID()
var subRegion = '';
var subR = GlideRecord('sys_user');
subR.addQuery(sys_id'', currentUser );
subR.query();
if (subR.next()) {
subRegion = subR.u_subregion;
}
if (subRegion == 'servicenowLand') {
action.setRedirectURL('www.www.ww');
} else {
action.setRedirectURL('www.xxx.xx');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 06:05 AM
Hi ZA,
It is working fine for me.Thanks a lot for your information.
Regards,
Nagaraju