cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
soylaunica
Level: Powered On

Help with Parsing

Hey All!

 

I'm currently working on a multi level approval workflow where we are parsing out an email and taking the information to passthrough to a quote approval request formatted email to get approved. Below you will find the structure of the email. My biggest hiccup currently is related to the link that follows "Please click to open quote attachment". A requestor can add any number of file types for the customer to review as supporting documentation for the quote. Because the last part of the url will change based on the file name, I find myself at a loss as to the best way to parse it out without throwing an error. Additionally, if the user does not attached supporting documents, that verbiage and url are not there in the email at all. This is the current expression I have, but I know that it will eventually throw an error. the replace '-' with '' is to accomodate the posibility of a signature line that's embedded into our email when we send. Which also may or may not happen. Any recommendations? I have put "x" for confidentiality but the character count is accurate. 

 

emailtobeparsed.PNG

 

Expression to parse out URL

if(contains(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50)),'-'),trim(replace(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50)),'-','')),trim(substring(body('Html_to_text'),indexOf(body('Html_to_text'),'https'),add(sub(add(lastIndexOf(body('Html_to_text'),'QuoteDocs'),10),indexOf(body('Html_to_text'),'https')),50))))

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help with Parsing

 

Hi @soylaunica ,

 

Please try to use the following expression to get the URL.

I did a test on my side and used a similar email body.

trim(last(split(body('Html_to_text'),'Please click to open quote attachment')))

Image reference:

54.PNG

55.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Help with Parsing

 

Hi @soylaunica ,

 

Please try to use the following expression to get the URL.

I did a test on my side and used a similar email body.

trim(last(split(body('Html_to_text'),'Please click to open quote attachment')))

Image reference:

54.PNG

55.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

soylaunica
Level: Powered On

Re: Help with Parsing

While I much prefer this method, it still doesn't account for the signature. Sometimes there is a signature in the email and therefore this method contains the signature in the bottom. Is there maybe a way I can say up to however many characters without it erroring out? What I'm thinking is after the QuoteDocs/ the filename up to let's say 50 characters, then trim.

 

 parse result.png

Highlighted
Community Support Team
Community Support Team

Re: Help with Parsing

 

Hi @soylaunica ,

 

Does the signature you mentioned have any characteristics?

 

If there is, or fixed content, we can also separate it.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,684)