Help

Create with null ID for lookup

Topic Labels: API
1578 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Romain_Gouzerh
5 - Automation Enthusiast
5 - Automation Enthusiast

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 :grinning_face_with_sweat:

0 Replies 0