Help

Unlink all linked records?

Topic Labels: API
2309 6
cancel
Showing results for 
Search instead for 
Did you mean: 
sull
6 - Interface Innovator
6 - Interface Innovator

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.

6 Replies 6
sull
6 - Interface Innovator
6 - Interface Innovator

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

Chinara_James
6 - Interface Innovator
6 - Interface Innovator

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?

Giovanni_Briggs
6 - Interface Innovator
6 - Interface Innovator

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": []}}

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

sull
6 - Interface Innovator
6 - Interface Innovator

Thanks for the info, folks.

yes, that is correct.