Skip to main content
julienc
October 29, 2025
Question

Create record filters to use with different relationships that point the same table (city address)

  • October 29, 2025
  • 4 replies
  • 0 views

Hi there!

Say I have several record types that have a postal address. 

For each record type, I have to do an advanced search on the address related to the record type

I would like to use a rule to create the filter, and use the rule instead of repeating the code each time. But for this to work, it looks like I have to pass each field as a separate input to my rule.

  a!queryFilter(
    field: ri!inputFieldCountry,
    operator: "=",
    value: ri!searchCriteria.country,
  ),
  a!queryFilter(
    field: ri!inputFieldDistrict,
    operator: "in",
    value: ri!searchCriteria.district,
  ),
  [...]

Is it possible to only pass the *relationship* as input, and then say to Appian to look for the field within that relationship? I don't think it's possible, but sometimes I get surprised by some Appian magic.

Here is what I tried, to no avail yet.

  a!queryFilter(
    field: ri!relationshipToAddress[{recordfieldCountry}],
    operator: "=",
    value: ri!searchCriteria.country,
  ),
  a!queryFilter(
    field: ri!relationshipToAddress[{recordfieldDistrict}],
    operator: "in",
    value: ri!searchCriteria.district,
  ),
  [...]

4 replies

stefanhelzle0001
October 29, 2025

Not possible. Records are very static as of now.

October 29, 2025

If I'm reading this correctly, then a!relatedRecordData() might work if the relationship to addresses is 1:many. a!relatedRecordData() explicitly does not work for many:1 or 1:1 relationships, for some reason [emoticon:ad09a845b95e4cb28c5d9684a032037c].

If addresses are many:1, then the reverse of this works by using the relationship inputs as part of the selected fields, rather than the query filter fields, if you start with the address as the base record type. To supplement the filtering for the search, a!relatedRecordData() or lists of a!queryFilter() can be passed in as an Any type, to your rule.

Example of the former:

shubhama926776
October 30, 2025

No, not possible.
Requires explicit static field references in filters to compile queries correctly, so dynamic field references inside relationships are not possible. Use a reusable rule with specific inputs for each address-related field to avoid code repetition.

harshas2775
October 30, 2025

No, its not possible to pass the relationship as rule input. This seems apt for the situation if repetition of code is to be avoided! 

it looks like I have to pass each field as a separate input to my rule.