Business rule condition doubt

rafas_2703
Tera Guru

Hi everyone, hope you are doing wonderful!

I have a Business rule that I need to change to meet some requirements but I am with some doubts on how to do it

 

The requirements are:

Run only for interactive sessions.

If conditions should be added to main Business rule condition.

 

The Business part that I need to change is the following:

 

if (!gs.getUser().hasRole('admin')) {
        var usr = new GlideRecord('sys_user');
        usr.addQuery('sys_id', gs.getUser().getID());
        usr.query();
        if (gs.getUser().hasRole('sn_hr_core.basic') && !gs.getUser().hasRole('itil')) {}
 
I don't have nothing written in the condition field but I don't know what to put there. Could someone help?
Thanks!

 

1 ACCEPTED SOLUTION

so Your complete BR condition becomes

(gs.getUser().hasRole('admin') || gs.getUser().hasRole('sn_hr_core.basic')) && !gs.getUser().hasRole('itil') && gs.getSession().isInteractive()

Which is 

Session is interaction

AND

User has admin or sn_hr_core.basic Role

AND

USer does not have ITIL

-Anurag

View solution in original post

2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

interactive session can be checked using this

gs.getSession().isInteractive();
-Anurag

so Your complete BR condition becomes

(gs.getUser().hasRole('admin') || gs.getUser().hasRole('sn_hr_core.basic')) && !gs.getUser().hasRole('itil') && gs.getSession().isInteractive()

Which is 

Session is interaction

AND

User has admin or sn_hr_core.basic Role

AND

USer does not have ITIL

-Anurag