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

Parsing out a changing url in email body

Hello!

 

I am trying to parse out the url in the below email, the issue is that it can change based on the filetype uploaded. Additionally, this url and the line above it will not be in the email if they do not upload the optional documentation. Below find email and expression. The character count of the url is accurate up to filetype. Any recommendations?

 

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 REPLY 1
Dual Super User II
Dual Super User II

Hi @soylaunica 

 

since your html text contains the url in the last line

you should use the split expression to split the text by the new line character and then use last expression to ge the url

 

Post on how to split using the new line expression

https://powerusers.microsoft.com/t5/Building-Flows/Need-to-find-new-line-characters-in-a-body-of-tex...

 

result of spliturl is present

use last expression

 

last(split(-----))

this will give u ur result

 

also to check if the url is present

do indexof and check and see if it returns a valid index

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (11,901)