Skip to main content

Action: Airtable’s “Create Records (With Line Item Support)”.

Issue: One field is getting ALL line items’ data, not just its own data. 

Here’s a screenshot.  The problem field is “Bundle” - each line item should have “Self-study course”. Note that “Billed, date” is populating perfectly, with each line item having only its own data.

Each line item is receiving ALL line items’ data, not just its own.

My only guess is that this has to do with the spaces in “self-study space course”, and that somehow is messing with things? But I unfortunately can’t just change the name to be without spaces.

Any ideas?

Hi @Sigurdur130 

That depends on how the data is originally configured.

For us to have more info, post these screenshots:

  • How your Zap steps are outlined and configured in EDIT mode
  • How the data is returned from the originating Zap step for the data points you are trying to map to Airtable

Thanks for the reply, @Troy Tessalone. Here are the screenshots.

The data is coming from a webhook get request. Here’s the relevant part of the test output (the highlight is me doing ctrl+f).

And here’s the Airtable step. It looks good in the Zap editor: just one instance of ‘self-study course’.

 


@Sigurdur130 

Issue may be due to nested array items that get flattened into a string instead of staying formatted as arrays.

Can’t say for sure since the screenshots from Zap step 4 shows partial data returned.


@Troy Tessalone, That sounds like a likely cause. I’m not sure what I can screenshot to find confirmation?

Also, assuming it is that nested array items are getting flattened into a string instead of staying formatted as arrays: what would I do about that?


@Sigurdur130 

You may need to use a Code step to make the API request then handle the returned data with custom code logic.


I may have found screenshots that could clarify if an array flattening to string is the problem.

In a request that had two invoices with no discount, and one invoice with a 50% discount, the result in Airtable was all 3 invoices being logged as having a 50% discount. The screenshots manage to capture the full data of the field. Does this help confirm anything?

I have to admit, doing this via Webhook was already daunting, going full code-step seems insurmountable. Is there any other available workaround?


@Sigurdur130 

Perhaps take a step back and define what you are trying to do with the entire Zap.

Post screenshots showing how your Zap steps are outlined and configured in EDIT mode to show how the fields are mapped in order to give us full context.


Alright, taking a step back, here’s a high-level overview of what I’m trying to accomplish.

I send invoices with the Payday app. It does have a Zapier integration, but no useful triggers. I’m trying to get around that, jury-rigging a ‘when an invoice is sent’ trigger so I can update my CRM in Airtable. Here’s how I envisaged it would work.

A ‘schedule by Zapier’ trigger fires once a day at 11pm. The API is session auth based, so I have a POST webhook step exchanging ClientID and ClientSecret for a bearer token. The date formatter step takes the ISO formatted date from the ‘Schedule by Zapier’ step and makes it readable for the API. The GET webhook then uses the bearer token from the POST webhook for authorization, and the date from the formatter to only get invoices sent on that particular day.

I figure the Scheduler, POST, and formatter actions are all straight-forward and probably not super relevant, so I’ll hold off on detailed screenshots off those to focus on the GET and the Airtable actions.

Here’s the GET action’s configuration. I reckon it’s a bit weird, with all the stuff that probably should be in the Query String Params in the URL, but that was the only way it would work, for whatever reason.

The GET step’s output is huge, so I’ll limit it to three screenshots which include the ‘self-study course’ field. If we need the whole thing for context, I’ll post it.

And here’s the Airtable configuration. I included the dynamic search in the screen to show the full field. 

Here’s the Airtable’s test data in. Three instances of ‘self-study course’ in a neat little array (apparently).

And here’s the test’s data out. Each record with a triplicate ‘self-study course’.

Alright, I hope that’s enough context! I don’t think I’ve ever taken so many screenshots in a sitting xD


@Sigurdur130

Since you are getting multiple records back from the GET API request, each record is an array.

Then the “lines” within each returned record are an array.

So you have an array of arrays.

The nested arrays get flattened into a string.

That is why you are experiencing the issue with a comma separated value being sent to Airtable instead of a single option for the Airtable field.

 

An alternative approach to try would be to get the list of results, then use the Looping (Create Loop from Line Items) to iterate thru each return record.

Within the loop you would add a step to GET the individual invoice by ID.

Then create an Airtable record per invoice.

That way you are handling each invoice individually vs trying to deal with nested arrays.

e.g. If there are 10 invoices to process, then the Looping step would run 10 times, once per invoice.

 

 


Reply