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

Parsing an email with a changing url

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. 

 

Email output to be parsed:

Quote#: 1234

Quote Amt: 10.00

BU#: 1234567

Customer Email: xxxxx@xxx.com

Originator Email: xxxxxx@xx.xxxxxx.com

 

 

Please click to open quote attachment

xxxxs://xxxxxxxxxx.xx.xxxxxxxx.com/QuoteDocs/filename.filetype

 

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
soylaunica
Level: Powered On

Re: Parsing an email with a changing url

I actually ended up using the split() and first() functions to get my result. Works much better now!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Parsing an email with a changing url

@soylaunica 

Hi there!  I had a similar requirement and chose to use a third-party tool.  There are a few out there, but the one I chose was Parserr and they have a free plan.  Might be worth checking out.

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

soylaunica
Level: Powered On

Re: Parsing an email with a changing url

I actually ended up using the split() and first() functions to get my result. Works much better now!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 468 members 6,347 guests
Please welcome our newest community members: