Bypassing before query business rule whilst impersonating

Dubz
Mega Sage

Morning All,

Can anyone confirm if there is a way to exclude impersonated sessions from being affected by certain business rules?

So i have a bunch of before query business rules set up to restrict the access of various users to various tables. The one i have on the user table is causing me problems when impersonating someone who is covered by the business rule.

This rule basically says, if the user belongs to a company that is marked as 'retail' then only return them users that belong to their company or a company that is a child of their company. The trouble i'm having is that when i impersonate one such user i can't re-impersonate myself, i get the error below and i have to re-login to the instance to get back to my account.

'java.lang.NullPointerException Check logs for error trace or enable glide.rest.debug property to verify REST request processing'

I tried amending the rule to only run if the user is a retail user and does not have the admin role but the impersonation masks my admin role. It's not a major issue but it's pretty annoying!

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

Try adding this condition to your business rule and you should be good.



JSUtil.nil(gs.getImpersonatingUserName())


View solution in original post

2 REPLIES 2

Kalaiarasan Pus
Giga Sage

Try adding this condition to your business rule and you should be good.



JSUtil.nil(gs.getImpersonatingUserName())


Beautiful! Thanks Kalaiarasan, it works like a charm