Help

Re: How to create new record in Link-to column with value (instead of record-ID)

1708 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Gino_Belvedere
5 - Automation Enthusiast
5 - Automation Enthusiast

I am trying to create new records via airtable.js,

when I try to create a new record in Link-to column with row-value (i.e. name - string not Record ID),
it does not work and reply

Class {error: “INVALID_RECORD_ID”, message: “Value “VALUE” is not a valid record ID.”, statusCode: 422}

Is there any way to avoid this condition?

or there is not “typecast” command in airtable.js ? if yes, please let me know some example,

var dataCompt = {
    "field1": "value1(text)",
    "field2(Link-to column)": "value2(text)" 
};

function createATData(){

base(tableName).create(dataCompt, function(err, record) {
    if (err) { console.log(err); return; }
    //loadArtists();
});

}

11 Replies 11
Erin_OHern
6 - Interface Innovator
6 - Interface Innovator

Hi all,

You should be able to create/update records by sending a value rather than record ID, as long as the typecast parameter set to true.

In the API docs, you should see this message under “Create records”:

The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is passed in (click to show example). Automatic conversion is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources.

If you click on the link in the message in your API docs, you’ll see examples of how this param is added to a curl request or Javascript code.

I hope this helps!

globers
6 - Interface Innovator
6 - Interface Innovator

I was looking for help on how to do just the same and stumbled upon this old topic.

As a Make.com (previously Integromat) newbie, it made me realize that I was feeding the API with a value rather than the record ID it was looking for. So I fed it with the record ID output by the "search record" module. Easy. I don't know how many of you have been trying to do this (or physically could do it at the time of posting due Airtable's API and Integromat's features).