Unlink all linked records?

#1

It seems that in order to remove all records from a linked field type during a patch/update, you have to always have at least one valid record id to include and keep linked. Otherwise, if try to update with an empty array (to clear the data out presumably) it gives an error that the record id is not valid.

0 Likes

#2

I may be wrong, but cannot delete this.
I think I had an externality causing this behavior.

0 Likes

#3

Hey @sull
Let me see if I can also recreate, because I’m current writing a tutorial on Airtable and linked records.
You want to unassign the records from the linked table but keep them in their original table correct?

1 Like

#4

You can do this using a PATCH on the record, and set the linked field to null. That will remove the links, but preserve the records in the other table.

For example, if record A has field “Links” which contains records B,C,D. I would issue a PATCH to record A with {"fields": {"Links": null}}. After the operation completes, record A will no longer link to records B,C, and D, but the records still exist in their corresponding table.

Alternatively, you should be able to send an empty array. I just tested on one of my bases and it worked using {"fields": {"Links": []}}

2 Likes

#5

Yea I used an empty array but nice tip on the patch

1 Like

#6

Thanks for the info, folks.

0 Likes

#7

yes, that is correct.

0 Likes