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, ), [...]
Discussion posts and replies are publicly visible
Not possible. Records are very static as of now.
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 .
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:
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.
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!
julienc said:it looks like I have to pass each field as a separate input to my rule.