Skip to main content
vamsik6197
September 23, 2025
Solved

Reusable interface in record field, duplicate validation check

  • September 23, 2025
  • 15 replies
  • 0 views

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.

Best answer by shubhama926776

You can also do this in field-level validation as mentioned above.
Check the syntax below and replace it with your record type appropriately.

if(
  a!queryRecordType(
    recordType: cons!YOUR_RECORD_TYPE,
    filters: {
      a!queryFilter(
        field: 'recordType!YourRecordType.fields.username',
        operator: "=", 
        value: rv!record['recordType!YourRecordType.fields.username'] 
      ),
      a!queryFilter(
        field: 'recordType!YourRecordType.fields.id', 
        operator: "<>", 
        value: rv!record['recordType!YourRecordType.fields.id']
      )
    },
    pagingInfo: a!pagingInfo(1, 1) 
  ).totalCount > 0, 
  "Username already exists",
  null
)

15 replies

harshas2775
September 23, 2025

In the Record->Data Model you can configure common validations for a field. Refer related Document here and here  which uses a!applyValidation for reusable validations for reusable interfaces for record field. Generally for checks like '@' in email or phone number formatting this validation configuration will be helpful. 

For Duplication check in your usecase I suggest you to create validation logic and configure them in the reusable interface for each field. You can use 'additionalValidations '  attribute of the a!applyValidation() to check duplicates and show validation as configuring/testing them in the Data Model field's Validation can be tricky. Below is an example where date validation is added on the reusable interface for the endDate field. Similarly you can check for duplicate using an expression and show user's validation message. Hope it helps!

 

a!applyValidations(
 recordField: recordType!Case.field.endDate,
 context: ri!record,
 additionalValidations: {
    if(
     ri!record[recordType!Case.fields.endDate] > today(),
     "",
     "Enter Valid Date"
    )
    }
)


vamsik6197
September 24, 2025

To do the duplicate check, i have to query the record to get existing values. So Appian will have to query the record for each field.

harshas2775
September 24, 2025

Yes within the textField->Validations of the field's interface you can query the record type. Pass the value in the queryfilter to checks of duplicates instead of gettting all existing values from record. 

So Appian will have to query the record for each field.

Even when we dont use reusable interface, the validations need to have queryRecord for each field which you need to check, so its similar! Appian will query the record by passing in the value of the field and check if duplicate exists - This remains the same with or without reusable interface. 

shubhama926776
September 23, 2025

Configure validation directly on the record field: Record Type -> Field -> Validations with a!queryRecordType() duplicate check expression.
This automatically applies to all reusable interfaces via a!applyValidations() function without modifying individual interface code

https://docs.appian.com/suite/help/25.3/fnc_system_a_applyValidations.html

This documentation will solve your all questions.
https://docs.appian.com/suite/help/25.3/build-best-data-fabric.html#reusable-record-field-validations

vamsik6197
September 24, 2025

To do the duplicate check, i have to query the record to get existing values. So Appian will have to query the record for each field.

stefanhelzle0001
September 24, 2025

Did you consider to add a form or section level validation?