Advanced condition in business rule is not working( two not equal to condition)

Anitha33
Kilo Explorer

Requirement :  to run BR when current logged in user is not the problem manager or not belongs to the role "thd pm admin".

 

Advanced condition:

gs.getUserID() !=  current.u_problem.u_problem_manager || !gs.hasRole('thd pm admin')

 

 

If I give one condition (gs.getUserID() !=  current.u_problem.u_problem_manager)  alone its working 

If I give one condition (!gs.hasRole('thd pm admin'))  alone its working.

If I give both the condition in advanced condition its not working(OR operators is not working for two condition).

 

 

Please suggest immediately.

 

 

 

 

find_real_file.png

1 ACCEPTED SOLUTION

Brent Sutton
Mega Sage

Hi Anitha,

I think you should be using AND instead of OR. Should look like the following: -

(gs.getUserID() !=  current.u_problem.u_problem_manager) && (!gs.hasRole('thd pm admin'))  

Let me know if this worked for you,

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

View solution in original post

9 REPLIES 9

Hi Brent Sutton,

 

It should be OR condition.

 

Actual requirement is (problem manager for the concern problem number or user has role "thd pm admin" should able to cancel the task.)

 

for other users error should be pop up. and abort the transaction.

 

So BR should run When current user is (!problem manager or !thd pm admin)

 

 

 

Hi Anitha,

You should be using && as the condition will check that they first aren't the problem manager and then check that they also aren't the thd pm admin. It works the opposite to what you might think as you are excluding these roles. 

Did you test your condition with the code I provided?

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

Hi Brent Sutton,

 

Yes i tested the condition with the code provided by you. It is working fine.

Hi Anitha,

Glad that you got it working.

Please mark my answer as correct so this thread can be closed and other community members can benefit from this information.

Brent

Hi Anitha,

Just checking if my answer solved your question. If so, please mark as correct so this thread can be closed and other community members can benefit from this information.

Thanks in advance,

Brent


P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.