I have a related sync record One to Many - Request and Watchers.
I am trying to query data from Request record but filter the data so only those requests for which the watcher is the one provided in filter is there as well as isActive should be true.
But the response i am getting back is weird. Please have a look at the attached screen for rule as well as the data.
It's returning data which doesn't seem to satisfy filter criteria. Am i missing something? please suggest.
a!queryRecordType( recordType: 'recordType!{5c74086c-d578-4cb3-bcc9-462eac05e87d}CLM Request', filters: { a!queryFilter( field: 'recordType!{5c74086c-d578-4cb3-bcc9-462eac05e87d}CLM Request.relationships.{456939a6-4ebb-43c0-9f2a-89523af6a1f1}clmRequestWatcher.fields.{72eced9d-9111-4afa-9a19-ec3dbb59e196}isActive', operator: "=", value: false() ), a!queryFilter( field: 'recordType!{5c74086c-d578-4cb3-bcc9-462eac05e87d}CLM Request.relationships.{456939a6-4ebb-43c0-9f2a-89523af6a1f1}clmRequestWatcher.fields.{30dd7a9a-a513-448d-950a-3667fb43d727}watcher', operator: "=", value: "claims.configuser" ) }, pagingInfo: a!pagingInfo(1, 100) )
Discussion posts and replies are publicly visible
The issue here seems to be because by default the filters parameter uses the "AND" operator, when you need to use the "AND_ALL" operator. You will have to use a!queryLogicalExpression to do so but I would say 99% of record queries with one to many relationships should use the "AND_ALL" operator. You can read more about it here: https://docs.appian.com/suite/help/latest/fnc_system_a_querylogicalexpression.html#using-the-and_all-operator but the general idea is when it comes to one to many relationships, the "AND" operator will return any record that has at least one related record that satisfies each of the conditions, whereas the "AND_ALL" operator will return any record that has at least a single related record that satisfies all of the conditions. Hope this helps!