Skip to content
Airtable Attachment...
 
Notifications
Clear all

Airtable Attachment Field - Array of Objects Expected in Parameter

6 Posts
2 Users
0 Reactions
3 Views
avallese
(@avallese)
Posts: 4
Active Member
Topic starter
 

Hi everyone! I'm seeking assistance with the following scenario:

  1. A list of products is retrieved from Shopify.
  2. I need to add a record in Airtable with one or more "Attachments", based on the data from Shopify. I'm encountering the following error: "Array of objects expected in parameter in field "Adjunto" (Attachment)".

This is the data returned from Shopify; this field can contain one or more image URLs.

This is how I've configured the mapping in Airtable:

 
Posted : 02/12/2024 2:09 pm
Terry_Hopper
(@terry_hopper)
Posts: 8
Active Member
 

Hi there!

Airtable requires a collection that includes URLs and optionally FileNames. However, the map function you've used is currently sending a simple array of URLs.

For instance, if you adjust the “Map” control, you'll see that callin.io is looking for a structure similar to this:

You can map the Src field to the File URL field here.

This approach will, naturally, only import the first image.

To construct the correct array, you could iterate over your Images array and then utilize an Array Aggregator to build the appropriate collection for mapping to the Airtable app. If this sounds complicated, I'm happy to guide you through it!

It should look something like this:

The Iterator

The initial Iterator should be mapped to your Images array. In my setup, the Images array is named “Logo”:

The Array Aggregator

Choose your Iterator as the Source Module.
Your Target Structure Type should be your Adjunto field in the Airtable module.
Map the File URL from your Iterator module.

The Airtable Module

Map the Adjunto to the Array generated by the Array Aggregator module:

Like this:

Please let us know how it works out.

Best regards, Terry.

 
Posted : 02/12/2024 3:14 pm
avallese
(@avallese)
Posts: 4
Active Member
Topic starter
 

Hello! Thank you for getting back to me.

My goal was to avoid incorporating additional modules into my workflow.

Previously, I utilized Google Sheets, and a function there successfully returned all the URLs separated by commas. Is there a similar workaround available?

 
Posted : 02/12/2024 4:30 pm
Terry_Hopper
(@terry_hopper)
Posts: 8
Active Member
 

Hi,

Apologies, but that's not possible without additional modules. The map function you've utilized is currently sending a basic array of URLs, whereas Airtable requires more detailed information.

Best regards, Terry.

 
Posted : 03/12/2024 12:18 pm
avallese
(@avallese)
Posts: 4
Active Member
Topic starter
 

Hi Terry,

Is it possible to convert this into JSON format or a similar structure?

json
[
{
"url": "Images[1]Src"
},
{
"url": "Images[2]Src"
}
]

I realize that this JSON cannot be directly pasted into the "Adjunto" field.

 
Posted : 03/12/2024 3:14 pm
avallese
(@avallese)
Posts: 4
Active Member
Topic starter
 

I've discovered a workaround.

Since the JSON can't be passed directly into the “Attachment” field as it's treated as a simple string, I utilized the Json Parse module.

I also incorporated an If statement to construct the JSON properly. In my specific scenario, I only required three images.

I suspect there might be a more straightforward solution. I found inspiration in this discussion:

 
Posted : 03/12/2024 3:50 pm
Share: