Skip to main content
All CollectionsFlatfile Data Exchange PlatformGuides
Run Validations On All Fields Of A Certain Type
Run Validations On All Fields Of A Certain Type
Elisa Dinsmore avatar
Written by Elisa Dinsmore
Updated over a week ago

This article is for the latest version of the Flatfile Data Exchange Platform.

Flatfile's Data Exchange Platform enables you to assign the field validations that work best for your users - if you want to validate dates differently depending on where in the world your users live, you can do that! Blueprint does not perform any validations on your fields out of the box.

However, you may not want to have to list all your field names when writing out validations for fields of a certain type. If you might be regularly updating your Blueprint, this could get messy and lead to fields being missed.

Fortunately, you can easily find all fields of a certain type when writing your validations. First, import your blueprint to the file where you're running your listener code, and then foreach on the fields to find fields of a certain type.

datefields = sheet.fields.filter(f => f.type === “date”).map(f => f.key)

Now you have an array of field keys that is up to date and can be used in your validations!

Did this answer your question?