Need to extract data from email Body like Invoice number, Invoice Date and Invoice Amount

The following will be transferred to your bank account on 08-MAY-17 by OU2510 EGDI.


1029014334 CAD $297,176.29


OPENBILL-491741 17-APR-17 $ 29,167.08
- OPENBILL Invoice(SAP File: OPENBILL_INVOICES_14042017.csv)
OPENBILL-491734 17-APR-17 $ 19,026.87
- OPENBILL Invoice(SAP File: OPENBILL_INVOICES_14042017.csv)
OPENBILL-491737 17-APR-17 $ 248,982.34
- OPENBILL Invoice(SAP File: OPENBILL_INVOICES_14042017.csv) ==============================================================================

If there are any questions, please call Accounts Payable at 416-495-5850.

Buddy @Puneet_Singh1

  1. Use get outlook mail activity to get the mail with variable of type list of mailmessages names out_mailmessages
  2. use a for each loop to iterate through each mail in the list by passing the variable out_mailmessages as input to the loop and change the type argument as mailmessage type
    3.Use a assign activity to split the mail body into array of lines like this with variable of type string array
    out_body_array = item.body.split(Environment.newline.ToArray(),Stringsplitoptions.Removeemptyentries)
    3.Then use a for each loop to iterate through this array of lines
    like by passig the out_body_array as iput with type argument as string in for each loop buddy
  3. inside the for each loop us a if condition like
    if this condition gets passed
    in then part of if condition use assign activities to get your outputs buddy @Puneet_Singh1 like this
    out_invoice_number = item.split("-“c)(1).ToString.Trim
    out_invoice_date = split(item,” “)(1).ToString
    out_invoice_amount = split(item,” “)(2).ToString+split(item,” ")(3).ToString

Thats all buddy you are done
Cheers @Puneet_Singh1

1 Like

Would you please share xaml of this. If possible.

Here is your sample xaml buddy @Puneet_Singh1 (2.8 KB)

Kindly let know whether this works or not buddy
cheers @Puneet_Singh1

Thanks @Palaniyappan
Invoice number, Date and Amount is Displaying blank inside if statement. I am looking into it

Buddy did you check with the modified one buddy i changed the condition a bit buddy with if condition @Puneet_Singh1

Did that work buddy @Puneet_Singh1
pu the condition like this buddy
item.Contains("$") and item.Contains(“OPENBILL”)

I tried with the attached one and in that it showing invoice number but date and amount is blank. I am date i am getting “”

Ya great its just index problem buddy

item.Contains("$") and item.Contains(“OPENBILL”) this is working fine. Getting blank value in if condition

1 Like

were you be to get the other values from that buddy @Puneet_Singh1

Yes other value are fetching but split(item,” “)(1).ToString and split(item,” “)(2).ToString+split(item,” ")(3).ToString is not working.

Buddy may i know how that line OPENBILL-491737 17-APR-17 $ 248,982.34 would be exactly , we are almost done, its just index issue buddy we can sort this buddy

OPENBILL-491737 --This is Invoice Number
17-APR-17 this is date
$248,982.34 This is the invoice amount.
I need to get these value from string OPENBILL-491737 17-APR-17 $ 248,982.34

Amazing, here you go
OPENBILL-491737 17-APR-17 248,982.34

out_invoice = split(item," “)(0).ToString
out_date = split(item,” “)(1).ToString
out_amount = split(item,” ").(2).ToString

it worked buddy @Puneet_Singh1

Try and let know buddy @Puneet_Singh1


Thanks sir…Will you please share this latest xaml.

Buddy here you go
mailinfo (2).zip (2.7 KB)

Kindly let know if this works or not buddy
Cheers @Puneet_Singh1

Still Invoice amount and date not displaying…Anyways thanks @Palaniyappan i will look into it and let you know once done.
Again thanks a lot for quick responce.

Change the index in split alone try buddy it should work as you are going good