I need to send multiple e-mails, but I do not know how to structure the Attachments field when using the Map.
Any ideas, please?
I need to send multiple e-mails, but I do not know how to structure the Attachments field when using the Map.
Any ideas, please?
Hey there,
most likely your array is not structured in the same way that the module is expecting. Its expecting the names of the variables to be “filename” and “data” and it looks like you are sending it an array with “name” and “content” instead.
Thanks for your time, @Stoyan_Vatov!
I’ve already tried your suggestion and small variations but the problem persists.
I’ve tried to look at Microsoft’s documentation (Add attachment - Microsoft Graph v1.0 | Microsoft Learn) but it doesn’t work either.
You do NOT need a Parse JSON module. See “Mapping a Specific Structure Into a Complex Field” below.
Every result (item/record) from trigger/iterator/list/search/match modules will output a bundle. This can result in multiple bundles, which then trigger multiple operations in future modules (one operation per bundle). To “combine” multiple bundles into a single variable, you’ll need to use an aggregator of some sort.
Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and can apply to many use-cases like building of JSON, CSV, HTML.
You can find out more about the other types of aggregator modules here:
The Array Aggregator module is very powerful because it allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.
This is done using the “Target structure type” field in an Array Aggregator module.
Here is an example:
As you can see, the “Map” toggle on complex fields are used when you have an array. You can easily build an array variable to map to a future module’s field, by using an Array Aggregator module and select the “Target Structure Type” as the future module’s field you have mapped the array into.
Here is an example of how your scenario could look:
This is just an example. Your final solution may or may not look like this depending on your requirements.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.
Hi, @samliew. Sorry for not replying previously, but we had our biggest holiday in Brazil (Carnaval).
I appreciate the detailed explanation you provided. I’ve just tested and it works perfectly!
However, I still need to add another file to the Attachments field that is unrelated to the iteration. Take a look at the image below, please:
To give you some context, I want to send an invoice and all the accounts receivable related to the same invoice. The relation between invoice and account receivable is 1 to N.
The iterator with the array aggregator is wrapping the accounts receivable. Now I need to download the invoice and send it as an attachment with the accounts receivable.
I’ve tried to use another iterator and array aggregator, filtering for just the first Bundle order position, but received the same error as before when using the add function to combine both array aggregators.
Any suggestions?
Instead of “add”, since you have two arrays, you can use the built-in function merge
.
e.g.:
{{ merge(5.array; 16.array) }}
For more information, see Array functions page in the Make Help Centre, which covers the following:
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.
Thank you, @samliew! It is working. I have just one more question if you don’t mind…
How would you do it if you couldn’t use the Target structure type in the Array aggregator? Is it possible?
No problem, really glad I could help!
1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.
2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.
This marks the topic as solved, so that:
To do this, simply click the checkbox at the bottom of the post that answers your question:
3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!
Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —
parseDate
| tokens for formatDate
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.