Urgent- How to fetch the view to determine the user is a portal user in business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 12:56 AM
I want to check whether the person's view is ess view or not. Because if it is, then that means the person who updated the field is a portal user.
If the user who updated the field is a portal user I have to fill the u_source field as 'Portal' through this business rule. I HAVE to stick to using business rule, i can t avoid them. Please help.
What I have been using is this code and it gives answer as null:-
var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
}
gs.log('ASHI View: '+view_name);
if(view_name == 'ess' && /*Here will come the client script lines*/){
current.u_source = 'Portal';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 01:04 AM
Hi Ashirav,
Do you want to check whether user has opened the record in portal or native? if yes then you can just check whether it is portal page or not
check in logs whether that parameter is present or not in url
var url = gs.action.getGlideURI().toString();
gs.info('URL is: ' + url);
check whether the view parameter is sysparm_view or only view
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 01:07 AM
Thanks for replying. It doesn't matter if the user has opened the record in portal. It only matters if the user has "updated' the record in portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 01:08 AM
Hi Ashirav,
check what comes in url first?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 01:35 AM
Okk, I will try now and let you know. Thanks for the pointers