Urgent- How to fetch the view to determine the user is a portal user in business rule?

Ashirav
Tera Expert

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';
}

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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.

Hi Ashirav,

check what comes in url first?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Okk, I will try now and let you know. Thanks for the pointers