web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Pulling information fr...
Power Automate
Unanswered

Pulling information from an email body

(0) ShareShare
ReportReport
Posted on by 82
Hello!
 
We receive airfare emails for our event attendees. Because I do not have AI Builder, I am pulling the information from the email body instead of from the attached Airfare Invoice.  The goal is to rename the invoice with specific information.  I have been able to successfully do this in all but one scenario through a series of Compose actions and a Filter Array.
 
Current flow searches for the word "Destination:" and returns what comes after it.  This works great, unless the person has a layover.  I need the final destination of the outbound trip pulled in order to rename the attached PDF correctly.
 
1.) When a new email arrives...
2.)  HTML to Text
a. triggerOutputs?()['body/body']
3.) Initialize Variable
a. Type = String
b. body('Html_to_text']
4.) Compose - Find Destination
a. substring(variables('varEmailBody'), add(indexOf(variables('varEmailBody'), 'Destination:'), 12), sub(length(variables('varEmailBody')), add(indexOf(variables('varEmailBody'), 'Destination:'), 12)))
5.) Compose - New Line
a. //carriage return
6.) Compose - Split Destination Lines
a. split(outputs('Compose-Find Destination'), outputs('Compose-newline'))
7.) Filter Array - Destination
a. From: Outputs['Compose - Split Destination Lines']
b. Filter Query: length(trim(item())) is greater than  0
8.) Compose - Destination Line
a. body('Filter_array_Destination')?[0]
9.) Compose - Destination Final
a. trim(split(outputs('Compose - Destination Line'),',')[0])
 
Assuming the below itinerary is in the body of the email, the flow would pull New York.  How do i get it to pull Destination 1 (New York) when there is no layover, and Destination 2 (Boston) when there IS a layover?  Keeping in mind that the return flights are also in this email body, so there would be (a) return Destination(s) that should not be taken into account.
Flight 9:00AM
 Flight Information
Carrier: Delta Air Lines Inc
Flight: DL 12345
Class: Economy
Origin: Los Angeles, CA
Departing: Monday 09 December 2024 at 9:00AM
Destination: New York, NY, New York LaGuardia Apt (LGA)
Arriving: Monday 09 December 2024 at 10:45AM
Flight 12:00AM
 Flight Information
Carrier: Delta Air Lines Inc
Flight: DL 54321
Class: Economy
Origin: New York, NY, New York LaGuardia Apt (LGA)
Departing: Monday 09 December 2024 at 12:00AM
Destination: Boston, MA, Boston Edward L Logan Intl Apt (BOS)
Arriving: Monday 09 December 2024 at 1:20PM
 
Would appreciate any help you can provide!
Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 112 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 52

#3
Ellis Karim Profile Picture

Ellis Karim 51 Super User 2026 Season 1

Last 30 days Overall leaderboard