cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
trentmallon
New Member

Power automate and XML email

I am New to power automate and am running into some issues,
I have an email getting sent to a Email address and i am trying to only take from that email what i need.
The issue i am facing is that i have some fields that contain errors but they all have the same Delimitators, i will put an example bellow

This one was simple as the Start and finish are different but these names are not used in the HTML anyware elce.

          OriginalMessageId>11123853</OriginalMessageId

 

But these are were i am having issues. what i would like it to show is bellow the 4 lines of HTML from the email 

What the HTML is 

          <Issue type="2025">Payment 70066391 successfully uploaded from a file.</Issue>
          <Issue type="2025">Payment 70066391 successfully uploaded from a file.</Issue>
          <Issue type="104503">Payment successfully validated.</Issue>
          <Issue type="181002">Payment has passed Account Validation.</Issue>

 

What i would like it to look like 

70066391 successfully uploaded from a file.

70066391 successfully uploaded from a file.

Payment successfully validated.

Payment has passed Account Validation.

 

 

 

now in Power automate i can get one of these to work with the following config but cannot get it to do them all what am i missing 

Initialize variable 

   Name = EmailStep12

           last(split(Variables('EmailBody'),'<Issue type="'))

Initialize Variable 

     Name = EmailStep13Issue

           first(split(variables('EmailStep12'),'</Issue>'))

 

Then Putting the Variable EmailStep13Issue into the Body of the email i send.

Now even if i copy this it only Duplicates the same error being Printed.
Any Help would be awsome.

 

8 REPLIES 8
jinivthakkar
Dual Super User
Dual Super User

@trentmallon this is what I tried, check if this helps.

 

jinivthakkar_1-1620028161514.png

jinivthakkar_2-1620028186704.png

 

Flow runs successfully

jinivthakkar_0-1620028123388.png

Output:

jinivthakkar_3-1620028232380.png

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

The issue here is that these errors change,
so i am pulling them from an email that is being sent to me From another business and that they can change from Day to day with what the errors are, /

so it will need to be able to scan the email and pull out the errors.

jinivthakkar
Dual Super User
Dual Super User

@trentmallon if it is going to be so dynamic then its really difficult. You will have to establish some format in which you communicate with the earlier team which sends you email

The format will be the same with the starting and the ending of each error have the same HTML tag like I had at the start. 
many ideas ? 

jinivthakkar
Dual Super User
Dual Super User

@trentmallon did you try the flow which I shared earlier, I showed you how it can be used, once you read received the data from email just pass it to html to text as I have shown.

@jinivthakkar 
yes I did have a look at this but how can I select that data only out of an email that has more data in it ? 

thanks 

jinivthakkar
Dual Super User
Dual Super User

@trentmallon please can you share a sample ?

Here is a copy of an email HTML,
I will put bellow what the fields that i am using already.
--> PaymentId
--> DateTime

-->OriginalFilename

--> UserMessage

now i need to be able to make the errors look nice and add them to my email but i can only seam to get one of the errors.
please let me know what you think. HTML bellow.

#####################################################################################

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoPlainText>&lt;PaymentsAcknowledgement type=&quot;info&quot;&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;PaymentId&gt;11123858&lt;/PaymentId&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;OriginalMessageId&gt;11123853&lt;/OriginalMessageId&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;DateTime&gt;2021/04/20&lt;/DateTime&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;CustomerId&gt;testcustomer&lt;/CustomerId&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;CompanyName&gt;Test Company Name&lt;/CompanyName&gt; &lt;UserMessage&gt;Payment status is PROCESSED&lt;/UserMessage&gt; &lt;DetailedMessage&gt;Payment has been successfully processed.&lt;/DetailedMessage&gt; &lt;OriginalFilename&gt;EFT2044486.ABA.asc&lt;/OriginalFilename&gt;<o:p></o:p></p><p class=MsoPlainText>&lt;Issues&gt;<o:p></o:p></p><p class=MsoPlainText>

&lt;Issue type=&quot;290049&quot;&gt;Uploaded Interchange 60063804 for Customer 382097 and Payment Type DL_DIRECTCREDIT.&lt;/Issue&gt;
&lt;Issue type=&quot;2025&quot;&gt;Payment 70066391 successfully uploaded from a file.&lt;/Issue&gt;
&lt;Issue type=&quot;2025&quot;&gt;Payment 70066391 successfully uploaded from a file.&lt;/Issue&gt;
&lt;Issue type=&quot;104503&quot;&gt;Payment successfully validated.&lt;/Issue&gt;
&lt;Issue type=&quot;181002&quot;&gt;Payment has passed Account Validation.&lt;/Issue&gt;
&lt;Issue type=&quot;6010&quot;&gt;Payment is ready for authorisation - 1 authorisations required.&lt;/Issue&gt;
&lt;Issue type=&quot;6014&quot;&gt;Payment has been fully authorised.&lt;/Issue&gt;
&lt;Issue type=&quot;181253&quot;&gt;AVCDEF GHIJKLM [1111111111] has authorised the payment.&lt;/Issue&gt;
&lt;Issue type=&quot;130000&quot;&gt;Available funds check passed.&lt;/Issue&gt;
&lt;Issue type=&quot;130001&quot;&gt;Funds have been reserved.&lt;/Issue&gt;
&lt;Issue type=&quot;181301&quot;&gt;Payment is ready to be submitted for processing.&lt;/Issue&gt;
&lt;Issue type=&quot;194500&quot;&gt;Disbursement Report for Direct Link - Direct Credit Payment: 70066391 sent to mailbox .&lt;/Issue&gt;
&lt;/Issues&gt;
&lt;/PaymentsAcknowledgement&gt;<o:p></o:p></p><p class=MsoPlainText><o:p>&nbsp;</o:p></p><p class=MsoPlainText><o:p>&nbsp;</o:p></p><p class=MsoPlainText>The information contained in this email and its attachments may be confidential.<o:p></o:p></p><p class=MsoPlainText>If you have received this email in error, please notify the sender by return email, delete this email and destroy any copy.<o:p></o:p></p><p class=MsoPlainText><o:p>&nbsp;</o:p></p><p class=MsoPlainText>Any advice contained in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on any advice in this email, National Australia Bank Limited (NAB) recommends that you consider whether it is appropriate for your circumstances.<o:p></o:p></p><p class=MsoPlainText>If this email contains reference to any financial products, NAB recommends you consider the Product Disclosure Statement (PDS) or other disclosure document available from NAB, before making any decisions regarding any products.<o:p></o:p></p><p class=MsoPlainText><o:p>&nbsp;</o:p></p><p class=MsoPlainText>If this email contains any promotional content that you do not wish to receive, please reply to the original sender and write &quot;Don't email promotional material&quot; in the subject.<o:p></o:p></p><p class=MsoPlainText><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>

 

 

 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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