Issue with Query Business Rule

valentin3
Tera Guru

Hello guys,

I have a problem here. 

I created a Query Business rule on task table that is running only for users from group X. The condition that I build is:

- assignment group to be group X

OR

- business service to be Y 
OR
- opened_by - user from the group X 

In list view is working fine, it display what it should display. 

The issue is when I try to open any record from that list (in this case incidents), it shows me other record from that list, but not the one that I clicked. It is the same for each record...I don't know where the issue is..

Could you help me?

1 ACCEPTED SOLUTION

You will have to replace it with .addOrCondition().

You can chain multiple together.

Like this:


current.addQuery('your_field', your_value)
.addOrCondition('some_other_field', some_other_value)
.addOrCondition('another_field', another_value);

 

View solution in original post

8 REPLIES 8

HrishabhKumar
Kilo Sage

Hi @valentin3 ,

Can you provide the code as well. Will be helpful for me to debug the issue.

 

Thanks.

Hrishabh Kumar

OlaN
Giga Sage
Giga Sage

Hi,

My guess is that you have added an encodedQuery in your business rule, and the encoded query contains multiple querys (^NQ). Like this example:
active=true^assignment_group=d625dccec0a8016700a222a0f7900d06^NQactive=true^assignment_group=287ee6fea9fe198100ada7950d0b1b73

This will not work in a before Query Business rule, because it basically states that a query should do a query which should do a query... and so on.

The results will be quite unpredictable, and all records you try to open will all point to the same record.

Do you have any suggestion on how to rewrite the query business rule without using the "NQ" in the encoded query? 

Thanks

You will have to replace it with .addOrCondition().

You can chain multiple together.

Like this:


current.addQuery('your_field', your_value)
.addOrCondition('some_other_field', some_other_value)
.addOrCondition('another_field', another_value);