Skip to main content

API create record fails - null for linked records

  • November 12, 2022
  • 3 replies
  • 36 views

The REST call from Appgyver for a new record fails, because the call has a ‘null’ for a linked record. Appgyver won’t remove the field just because its blank, so a null is sent - and Airtable breaks on it.

3 replies

ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • November 12, 2022

Assuming that the primary field of your linked table allows data to be written to it, you have 3 choices when posting your data to your linked record field:

You will either need to:
(1) Not send any data to that field at all,
(2) Create a “null” record in your linked table that your linked record field can link to, or
(3) Enable the “typecast” parameter in your API call, which will automatically create the “null” record in your linked table.


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • November 13, 2022

Actually, I just realized that “typecast” must be enabled for both the #2 and #3 scenarios above. You must always send a Record ID to a linked record field UNLESS typecast is enabled. Then, you can send the primary field name of an existing record OR a new record that doesn’t yet exist.


Greg_F
Forum|alt.badge.img+18
  • Brainy
  • 145 replies
  • November 14, 2022

It might be also related to linked field expecting array - try sending empty array?