@@ -488,15 +488,19 @@ FIELD TYPES (fieldType parameter):
488488
489489TYPE OPTIONS by fieldType:
490490 formula: { formulaText: "..." }
491- rollup: { fieldIdInLinkedTable, recordLinkFieldId, resultType, referencedFieldIds }
492- lookup: { recordLinkFieldId, fieldIdInLinkedTable }
491+ rollup: { relationColumnId: "fldLINK", foreignTableRollupColumnId: "fldTARGET", formulaText: "SUM(values)" }
492+ (formulaText is REQUIRED — e.g. "SUM(values)", "COUNTA(values)", "IF(OR(values='X'),1,0)"))
493+ (old keys fieldIdInLinkedTable/recordLinkFieldId are auto-translated for backward compat)
494+ lookup: { relationColumnId: "fldLINK", foreignTableRollupColumnId: "fldTARGET" }
495+ (old keys fieldIdInLinkedTable/recordLinkFieldId are auto-translated for backward compat)
493496 count: { recordLinkFieldId }
494497 number (integer): { format: "integer", negative: false }
495498 number (currency): { format: "currency", symbol: "$", precision: 2, negative: false }
496499 number (percent): { format: "percentV2", precision: 2, negative: false }
497500 date / dateTime: { dateFormat: "Local"|"us"|"european"|"iso"|"friendly", timeFormat: "12hour"|"24hour", timeZone: "UTC"|"client"|<IANA-tz>, shouldDisplayTimeZone: true|false, isDateTime: true (auto for dateTime) }
498501 singleSelect: { choices: [{ name: "Option A", color: "blueLight2" }] }
499502 multipleSelects: { choices: [{ name: "PC" }, { name: "Xbox", color: "greenLight2" }] }
503+ text / multilineText / checkbox / rating: omit typeOptions entirely — passing {} causes a 422
500504
501505SELECT CHOICES: pass an array of { name, color? } objects — the client auto-converts to the object format the internal API requires and generates valid choice IDs.` ,
502506 annotations : { readOnlyHint : false , destructiveHint : false , idempotentHint : false , openWorldHint : false } ,
@@ -596,12 +600,15 @@ Works for formula, rollup, lookup, count, singleSelect, multipleSelects, number,
596600COMMON typeOptions by fieldType:
597601
598602 formula: { formulaText: "IF({Field}, 1, 0)" }
599- rollup: { relationColumnId: "fldXXX", formulaText: "SUM(values)" }
600- lookup: { relationColumnId: "fldXXX", foreignTableRollupColumnId: "fldYYY" }
603+ rollup: { relationColumnId: "fldLINK", foreignTableRollupColumnId: "fldTARGET", formulaText: "SUM(values)" }
604+ (formulaText is REQUIRED; old keys fieldIdInLinkedTable/recordLinkFieldId auto-translated)
605+ lookup: { relationColumnId: "fldLINK", foreignTableRollupColumnId: "fldTARGET" }
606+ (old keys fieldIdInLinkedTable/recordLinkFieldId auto-translated)
601607 count: { recordLinkFieldId: "fldXXX" }
602608 singleSelect: { choices: [{ name: "Option A", color: "blueLight2" }] }
603609 multipleSelects: { choices: [{ name: "PC" }, { name: "Xbox", color: "greenLight2" }] }
604610 number: { format: "integer"|"decimal"|"currency"|"percentV2", precision: 2, symbol: "$", negative: false }
611+ text / multilineText / checkbox: omit typeOptions entirely — passing {} causes a 422
605612
606613SELECT CHOICES — pass an array of { name, color? } objects; the client handles the internal format.
607614
@@ -1771,7 +1778,12 @@ const handlers = {
17711778 if ( foundField . type !== 'formula' ) {
17721779 return { content : [ { type : 'text' , text : JSON . stringify ( { error : `Field ${ fieldId } is type "${ foundField . type } ", not formula` } ) } ] , isError : true } ;
17731780 }
1774- const formulaText = foundField . typeOptions ?. formulaText ?? '' ;
1781+ // Airtable's internal API has stored formula text at typeOptions.formulaText historically.
1782+ // Defensive fallback chain handles potential key renames in future API responses.
1783+ const formulaText = foundField . typeOptions ?. formulaText
1784+ || foundField . typeOptions ?. formula
1785+ || foundField . formula
1786+ || '' ;
17751787 const fieldName = foundField . name ?? fieldId ;
17761788 const description = foundField . description ?? '' ;
17771789 const resultType = foundField . typeOptions ?. resultType ?? '' ;
@@ -1805,7 +1817,10 @@ const handlers = {
18051817 await mkdir ( tableDir , { recursive : true } ) ;
18061818
18071819 for ( const field of formulaFields ) {
1808- const formulaText = field . typeOptions ?. formulaText ?? '' ;
1820+ const formulaText = field . typeOptions ?. formulaText
1821+ || field . typeOptions ?. formula
1822+ || field . formula
1823+ || '' ;
18091824 const fieldName = field . name ?? field . id ;
18101825 const description = field . description ?? '' ;
18111826 const resultType = field . typeOptions ?. resultType ?? '' ;
0 commit comments