Hi Team,
I am trying the new feature in record type, creating reusable interface for a record field.
https://docs.appian.com/suite/help/25.2/reference-records.html#reference-record-field-interfaces
i need to do duplicate validation for the fields, created by using re-usable interfaces for a record field.
Below is the interface definition of the created interface automatically by Appian, for the record field.
a!textField( label: 'recordType!{b1ecf478-0b29-4be8-a0f1-edc36a6d606a}SG IPL Match.fields.{4b2ebeae-9196-4a13-8d48-44abf5b765ae}username.properties.{displayName}displayName', labelPosition: "ABOVE", showWhen: fn!true(), value: ri!record['recordType!{b1ecf478-0b29-4be8-a0f1-edc36a6d606a}SG IPL Match.fields.{4b2ebeae-9196-4a13-8d48-44abf5b765ae}username'], saveInto: ri!record['recordType!{b1ecf478-0b29-4be8-a0f1-edc36a6d606a}SG IPL Match.fields.{4b2ebeae-9196-4a13-8d48-44abf5b765ae}username'], align: "LEFT" )
Now how to validate if username provided by user is not a duplicate one?
How to validate for multiple fields?
How to validate for related records for a specific country, for example, in states record, for state name field. i should check for duplicates for a particular country only.
Discussion posts and replies are publicly visible
As per standard practice, whenever you need to check for duplicate its best to query the data source by passing the value to check duplicates of in the filter instead of querying all data and then checking. If your dataset is very small then querying all then comparing can be fine but with large datasets you should query by passing paging batch size as 1 and filter by the value you want to check duplicate for. Paging batch size 1 ensures query will return just one row for the data value if duplicate is present else it will return null. Using this validation can be configured.
Otherwise the query of entire dataset and logic to check for duplicate can slow down your interface,
It depends on how many number fields if you have.If you want to check for multiple fields recommend call in interface directly on load of interface and use that for all validations.
Appian is querying each time user interacts with the field, so for each field it will querying each time time user updates something, which is not performant way right?
If you are using in interface and want data to load only once on initialization, it is recommended to use refresh variables with appropriate parameters. This ensures the data is not refreshed again on user interaction, even if the variable is referenced elsewhere in the interface. However, if you use this logic inside record field validation, be aware that it may impact performance, since the expression will be evaluated for every field.