a!recordData multiple filtering not working

Hello,

I'm using function a!recordData to return data from one of my records and I need to apply multiple filtering on the dataset:

data: a!recordData(
  recordType: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident',
  filters: {
    a!queryFilter(
      field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{a1a9fdf7-1d9b-48eb-a147-2a233271d74b}adGroup',
      operator: "=",
      value: local!adGroup
    ),
    a!queryFilter(
      field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}QUA Incident.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}assignedTo',
      operator: "<>",
      value: loggedInUser()
    )
  }
)

When I use both filters, data is not appearing at all, If I remove the second condition I can see some results that are aligned with the first filter definition.

However, If I use a!queryEntity function to retrieve the same data for the same entity I get 2 results ( the expected result).

a!queryLogicalExpression(
  operator: "AND",
  filters: {
    a!queryFilter(
      field: "adGroup",
      operator: "=",
      value: "GS-A2-CAPF-BPM-QUA-Bendern-Accountants"
    ),
    a!queryFilter(
      field: "assignedTo",
      operator: "<>",
      value: loggedInUser()
    )
  },
  ignoreFiltersWithEmptyValues: true
)

Can anyone please explain what could be the reason for not getting the same result with both approaches ?

  Discussion posts and replies are publicly visible

  • +1
    Certified Senior Developer
    in reply to Mike Schmitt

    Nice observation there, but I tried doing the same with a!queryEntity and it turns out that the behaviour is same i.e., "<>" will only look for not null values.

    So we need to apply a filter to get all null values also for this particular use case, either it is a!queryentity() or a!recordData() or a!queryRecordType()

    a!recordData(
      recordType: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}',
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: a!queryFilter(
          field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{a1a9fdf7-1d9b-48eb-a147-2a233271d74b}',
          operator: "=",
          value: local!adGroup
        ),
        logicalExpressions: a!queryLogicalExpression(
          operator: "OR",
          filters: {
            a!queryFilter(
              field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}',
              operator: "is null"
            ),
            a!queryFilter(
              field: 'recordType!{a24eedc6-9d03-4ecc-affc-9d0a19c7cc0d}.fields.{3729b606-5b1b-4fb8-b16b-c9e929833ece}',
              operator: "<>",
              value: loggedInUser()
            )
          }
        )
      )
    )

    Keen to know if there is any other solution to it.

  • Hi Sanchit this approach works as well. thank you for your help Slight smile