Groovy condition is not working

Hi All,

I am working on this example: https://documentation.bonitasoft.com/bonita//declare-business-variables but when I used the claim.satisfactionLevel < 3 it simply does not show me the "Deal With Unsatisfied Customer" form.

From the log I can see the value that I am passing for satisfaction level. Please find the script, Process and log file used, 

https://ibb.co/0GFrT6F

Appreciate any help.

Regards

Hi,

Where is your process after the Gateway ? On which Task ? Is there a condition that leads to End3 ? If the condition that lead to End3 is also true the first valid branch is followed and it leads to End3 in your case. You can change the transition evaluation order on the Gateway.

Or you can use a proper exclusive condition to avoid that both branch can be true (depends on what you want to achieve)

HTH

Romain

Hi Romain,

Thanks for getting back.

I want to display "Satisfied" form if the satisfaction level is greater than 3 and display Unsatisfied form if satisfied level is less than 3.

Please find the pic below showing the Groovy Script to deal with satisfied and not satisfied flow with Exclusive Gateway

Pic: Satisfied and Not Satisfied

The issue is when I say Satisfied Level is 2. It goes through the "Satisfied" route where it should have been "Not Satisfied" route.

Not sure what's the issue.

Regards

Muhammad

I also tried by changing the Groovy script for both Satisfied and Unsatisfied to below instead of if/else

Satisfied: claim.satisfactionLevel > 3 

Unsatisfied: claim.satisfactionLevel < 3

but still it goes through the satisfaction route when I enter satisfaction level is 2 

 

 

That's weird, what type is satisfactionLevel  in your model ?

Thanks for pointing out.

The issue was with the claim.satisfactionLevel. I used type as "TEXT" following the example from here, https://documentation.bonitasoft.com/bonita//declare-business-variables and think did not think twice it, that it could cause an issue.

Once change the type to INTEGER the routing is working ok.

Thanks a lot for your help Romain.

Regards

Muhammad