Hello,
I have a situation.
I'm trying to send an email - only to the peoples in share point list- each user will receive an email that contains a table with the items assigned.
the flow was working until I added the " Start and wait for an approval"... now I can send the email only if I write manually the email
Before adding the approval step in the To: field I added the output from "compose unique emails" and it worked perfectly well.
I've tried to convert the output into a string to add it in the send email step in To: field but that didn't worked... so I deleted it and run it again with the simple output in the TO field.. and this is the error
That type of data does "Send an email " accepts in to field... I understand that it can't be an array. But how I convert the output in something acceptable.
Thanks
Solved! Go to Solution.
Hi @roxanamoraru , please try below expression
join(xpath(xml(json(concat('{ "root": {"emails": ', outputs('Compose_Unique_Emails'), '}}'))), '//emails//text()'), ';')
Hey @roxanamoraru
Currently you are sending this to the send email:
[
{ "UserEmail": "abc@gmail.com"}
]
Instead you just have to send abc@gmail.com
To do this, in the send email instead of writing outputs:
write a similar expression:
outputs('NameOfYourEmailCompose').UserEmail
Hopefully this would work. 🙂
I am doing something wrong ?
Thanks!
No its fine, I knew this error would come. Let me try it on my end, I will give you the exact expression in a few minutes.
Can you show compose unique emails action in edit mode? If not try this thing:
In that only, write
currentexpressionthatyourareusing.UserEmail
By this you dont have to penetrate inside the array.
There are two other ways too, but that will create an extra apply to each. Hopefully the above works.
Hi @roxanamoraru , please try below expression
join(xpath(xml(json(concat('{ "root": {"emails": ', outputs('Compose_Unique_Emails'), '}}'))), '//emails//text()'), ';')
This is the compose:
This is the flow:
I would do the following:
1) Add another Parse JSON action to get the email values with the following schema:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"UserEmail": {
"type": "string"
}
},
"required": [
"UserEmail"
]
}
}
2) Append each email value to a semi-colon separated string
3) Use this string to send an email
Hope that helps!
Ferran
Thanks,
This works!!
But if I want to send separated email to people? Each person to receive the table with their items assigned? How I write the expression?
Thank you so much !
In that just write:
union(body('Select_Emails').UserEmail,body('Select_Emails').UserEmail)
And then just pass the output in the send email of this action.
I am sure this would work, if this does not, you can try @fchopo method's too, I was gonna suggest that method next. You can try @Amit_Sharma approach too, that looks the easiest, I am not good with xml so I have no idea about it.
thank you so much for your time and help !!
Thank you so much !!
Hi @roxanamoraru , If you want to send only assigned items to users then this might not work. Instead do the below modifications
1. Loop of all the emails one by one.
2. Filter items specific to the current email
3. Send email.
PS: I haven't followed the whole thread closely and may be wrong.
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
12 |
User | Count |
---|---|
127 | |
54 | |
38 | |
26 | |
21 |