cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashwnaidv100
Helper III
Helper III

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

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 III
Dual Super User III

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.

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

Pstork1
Dual Super User III
Dual Super User III

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.

Yeah I know the domain. Thanks for the logics. 

 

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (61,103)