I’m trying to add a dynamic distribution list to an email I send out with a logic app. It’s triggered whenever a blob is uploaded into a container it is watching.
Is it possible to:
- grab a value from the csv and enter it into the email that is being composed.
- Is it possible to exclude this column when it is being attached in the email?
For example if the csv were to be composed like so:
+----+---------+---------+---------+--------------------+
| ID | Column1 | Column2 | Column3 | Distribution List |
+----+---------+---------+---------+--------------------+
| 1 | 500 | R | 500 | [email protected] |
+----+---------+---------+---------+--------------------+
| 2 | 600 | R | 600 | [email protected] |
+----+---------+---------+---------+--------------------+
| 3 | 700 | DED | NULL | [email protected] |
+----+---------+---------+---------+--------------------+
I need the value in the distribution list column to go here:
The distribution list would only be there for the purpose of building the email, is there a way to remove it before the blob content is attached?
2
Answers
I have used given workflow to pass the distribution list name in the email and then removed the column before attaching it to the email.
I have used below JavaScript code to parse the csv data to JSON.
Parsed the JSON array and then used Select action to fetch the required columns and lastly used Create CSV table action to form a CSV table which will be used as an email attachment.
Code–
This gives me expected response.
Yes,
It’s a long question but yu can achieve all of it.
1. You can fetch email from CSV and add it to the email. You just need to Parse it to a JSON first. You can use this sample strategy.
2. You can exclude this column when attaching to email by creating a parsed CSV. You can do it by this strategy. Pass your JSON of qualifying values to this connector. The output can be attached to the email as File Content.