Hi Team,
I am building a flow, such that when an email (external mail) got received, it triggers the flow, by sending the approval mail to the Recipient (internal user). And there exists a condition, if the To address from the external mail got more than one internal user, it should pick up only one internal user for the approval.
What I do is, for Audit purpose, I am creating an item in Sharepoint (which stores Message Id, Recipients Outcome,etc). Below is the screen shot of my flow.
Splitting the Recipients address -
Checks the splitted Recipients address that contains internal domain address?
If yes, it is checking for the condition, if the sharepoint item has update - that if the title is equal to unique message id and (response is either approved/rejected) the flow should not continue to send email to the second internal user.
Meaning, here the approval mail should go to only one user, that's why i am checking the condition from SharePoint. but it is not working.
Why the condition fails?
Is there any other way to run the the approval mail only once? Since it is placed inside the Apply to each i am unable to terminate the flow as well.
Thanks for your help.
Thanks,
Harisha
I'm sure that it's me, but I don't totally understand your logic...
Howeverm have you considered using the first() expression after you split the email addresses rather than having an additional check? The first() expression will give you the first element in an array - so it will give you the first email address from the output of your split. So, it doesn't matter if there is a single email address or multiple addresses, you always get the first one.
Hi @ScottShearer ,
So, there will be emails triggered from external domain (gmail, yahoo). Suppose say, there will be multiple recipients in the mail.
For example: The To in the email is addressed to - user1@gmail.com, user2@internaldomain.com, user3@yahoo.com, user4@internaldomain.com . Now I need to send the email for approval for user2 no need to send approval to user4. So only one internal user from the recipients mail address has to get the approval.
So what I am doing, after splitting the mail address, I am checking for the condition if the address of the email contains internal domain name and applying condition to send mail for approval. Since it is running under the Apply to each condition, it is sending approval mail to both the user2 and user4. That is the problem.
Hope you understand. If you still did not have a clear idea please feel free to speak out.
Thanks,
Harisha
Hi @HarishaAkkil ,
I agree with @ScottShearer 's suggestion.
If you want to run the apply to each only once, you should keep the array has only one item in the input field of the Apply to each.
You could take a try with the first or last function before the apply to each.
And if you would keep the array with multiple emails in the apply to each and want the Apply to each to stop running when the special email address is found, please let me know and I would provide the workaround.
Best Regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-alzhan-msft ,
If I want to take the first internal user from the array, could you please help me with the code?
For example - user1@gmail.com, user2@internaldomain.com, user3@internal domain.com, user4@yahoo.com
How should I write the first or last function in such a way it takes the user2 alone?
Thanks,
Harisha
Hi @HarishaAkkil ,
You could refer to screenshot below to the email address:
split(variables('test'),', ')
first(skip(outputs('Compose'),1))
Best Regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-alzhan-msft ,
Thanks for your reply. I would like to clarify on the formula -
first(skip(outputs('Compose'),1))
means it does skip the first output right? Since we know the internal user is in second place, we are skipping the first output. But if we don't know the place where internal domain user is?
Please do tell me if you still didn't get what my request is.
Thanks,
Harisha
Hi @HarishaAkkil ,
You must know the place that email you need, or how can the flow know what is the needed one?
Best Regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-alzhan-msft ,
Yes that is the problem I am facing. When an email comes it should automatically find the internal user domain and send the notification. I should not manually go and check in which place the internal domain user is.
Thanks,
Harisha
Hi @HarishaAkkil ,
Does your issue still exists?
Best Regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Alice,
Yes I am still not able to find an answer.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
86 | |
58 | |
41 | |
35 | |
32 |
User | Count |
---|---|
79 | |
67 | |
57 | |
49 | |
40 |