dynamic filter with addOrCondition not working in query business rule.

Raj90
Tera Guru

Hello Folks,

 

We have a scenario - Chang Task assignment group members should be able to see the linked Change request.

 

For this I have created Task groups field with glide list type on Change request form, and added the task assignment groups to the Task groups field by using script.

 

I have written a below Query BR on change request table:

var userID = gs.getUserID();

var qc = current.addQuery("requested_by", userID).addOrCondition("watch_list", "CONTAINS", userID).addOrCondition("work_notes_list", "CONTAINS", userID);
 
if (gs.hasRole("change_builder")){
qc.addOrCondition('u_task_groupsDYNAMICd6435e965f510100a9ad2572f2b47704');
}
 
Unfortunately, the below condition (dynamic filter) is not working in the query br.
qc.addOrCondition('u_task_groupsDYNAMICd6435e965f510100a9ad2572f2b47704');
 
If we put the below condition only in the Query BR, it's working fine.
var qc = current.addQuery('u_task_groupsDYNAMICd6435e965f510100a9ad2572f2b47704');
 
Please help me to fix the issue.
 
Thanks,
Raj
1 REPLY 1

Rahul Talreja
Mega Sage
Mega Sage

Hi @Raj90 ,
Try with

current.addEncodedQuery('requested_by='+userID+'^ORwatch_listLIKE'+userID+'^ORwork_notes_listLIKE'+userID);

 

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul