Hi everyone! I'm seeking assistance with the following scenario:
- A list of products is retrieved from Shopify.
- 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:
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.
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?
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.
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.
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: