Aug 08, 2022 08:45 AM
I am trying to create a field which links a table to itself:
//Now that the table has been created add the linked field
var newFamily = base.getTable( familyName );
var linkOptions = {
linkedTableId: newFamily.id,
prefersSingleRecordLink: true,
isReversed: false,
};
await newFamily.createFieldAsync( ‘SpouseLink’, ‘multipleRecordLinks’, linkOptions );
I am getting an error:
j: Can’t create field: invalid field config.
Failed schema validation: prefersSingleRecordLink is not included in the .options schema, isReversed is not included in the .options schema
I am confused because I have include those fields in the schema …
Aug 08, 2022 12:12 PM
Welcome to the Airtable community!
Sometimes the error messages and/or documentation are not up to date. Try taking out both isReversed
and prefersSingleRecordLink
from the options. The scripting documentation currently says to not include them when creating a field.
// Note: prefersSingleRecordLink cannot be specified via programmatic field creation
// and will be false for fields created within an app
}
Aug 08, 2022 01:21 PM
That worked. Serves me right for looking and beleiving the error message which clearly states it is needed!
Sheesh