Create with null ID for lookup


#1

Hi,
I’m using the API to send my new Firebase entries (function) in Airtable but I’m having a problem. Some of these values are identfiants to add values from a Lookup (Allow linking to multiple records). But when adding some values can be null (it comes from checkbox) and then I have an error message like this: Value “” is not a valid record ID. Does anyone have an idea how to make Airtable understand not to consider if it’s null and just take those with a value?

Exemple :

function createAirtable(id) {
var t1 = event.data.t1;
var t2 = event.data.t2;
var t3 = event.data.t3;
var t4 = event.data.t4;

  base('Deb').create({
    "Date": xxxx,
    "Client": [id],
    "Heure": xxxx,
    "Etat": xxxx
    "Description": xxxx,
    "Info": xxxx,
    **"Véhicule": [t1, t2, t3, t4]** <== id for the lookup but some values will be empty

  }, function(err, record) {
    if (err) {
      console.error(err);
      return;
    }
  });
}

Thank you :sweat_smile: