Is there a way to extract an email id in flow (power automate) from approval comment output. I'm using approval connector to get an approval on a document but in the comment section the user or approver will put a email id with comments that i need to be extracted.
Approver Comment (Input): Ok its approved, I want this to be forwarded to firstname.lastname@example.org
Is it possible to get extracted, @xxxxx.com would be fixed substring, but prefix may vary depending on the user names.
Thanks for all the support.
In Power Apps this is easier because there is a REGEX function. But that's not available in flow. But If you can assume there is only one email in the comments and also that the character '@' is not used other than as part of an email. Then the high level process is this
1) Split() the comment on the '@' character
2) Split() the first entry in the resulting array on a space. The Last() entry in the resulting array is the first half of the email address.
3) Split() the second entry in the original '@' split array on a space. The First() entry in the resulting array is the email domain of the email address.
4) Concatenate the results from #3 and #4 around a '@' and you have the email.
Thanks for you response @Pstork1 , really appreciate it
I think in this case only your 1st assumption would be right but I won't be able to stop user to put multiple '@' in the comments in any ways. The process that you suggested, seems doable, but need for contexts and logics on your 2nd and 3rd step.
I have found its work around, and its working fine for the current testing's, below is my current work solution.
Approver comment, for eg: Ok its approved, I want this to be forwarded to email@example.com
1) Use 'Split' function on Approver Comment with space separator (' ')
Output: ['Ok', 'its', 'approved,', 'I', 'want', 'this', 'to', 'be', 'forwarded', 'to', 'firstname.lastname@example.org']
2) Use 'Apply on Each' with condition to check if current item contains '@xxxxx.com'
Output: true for 'email@example.com'
3) Email id (replaced any extra space)
I think 🤔 it works for now, but surely there will be challenges come in near future.
But if you could share how to do 2nd and 3rd step would be much better.
Yours should work better if you already know what the domain will be.
Here's the formulas for mine
#Split the approval comment split(ApprovalComment,'@') #Get the username portion of the email last(split(first(outputs('Compose')),' ')) #Get the domain portion of the email first(split(last(outputs('Compose')),' '))
Three Super User rank tiers have been launched!
Features releasing from October 2020 through March 2021
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!