cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to extract an email id from Approval comment (output of Approval connector in ms flow) ?

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.

 

For eg: 

 

Approver Comment (Input):  Ok its approved, I want this to be forwarded to abc.xyz@xxxxx.com 

 

Output: abc.xyz@xxxxx.com

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

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 abc.xyz@xxxxx.com

 

1) Use 'Split' function on Approver Comment with space separator (' ')

 

Output: ['Ok', 'its', 'approved,', 'I', 'want', 'this', 'to', 'be', 'forwarded', 'to', 'abc.xyz@xxxxx.com']

 

2) Use 'Apply on Each' with condition to check if current item contains '@xxxxx.com' 

 

Output: true for 'abc.xyz@xxxxx.com'

 

3) Email id (replaced any extra space)

 

Output: abc.xyz@xxxxx.com

 

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. 

 

Thanks again

View solution in original post

4 REPLIES 4
Pstork1
Dual Super User
Dual Super User

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

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 abc.xyz@xxxxx.com

 

1) Use 'Split' function on Approver Comment with space separator (' ')

 

Output: ['Ok', 'its', 'approved,', 'I', 'want', 'this', 'to', 'be', 'forwarded', 'to', 'abc.xyz@xxxxx.com']

 

2) Use 'Apply on Each' with condition to check if current item contains '@xxxxx.com' 

 

Output: true for 'abc.xyz@xxxxx.com'

 

3) Email id (replaced any extra space)

 

Output: abc.xyz@xxxxx.com

 

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. 

 

Thanks again

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')),' '))


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Yeah I know the domain. Thanks for the logics. 

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,757)