cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ftapiaj39
Regular Visitor

Building a flow that extracts date from email

Hi,

 

I am new to using power automate but i am trying to create a flow by extracting dates from a justworks email to create an event on the outlook calendar, I also noticed to create an event on I would need a time format which justworks does not provide. Below is an example of the email format:

Policy:

Vacation

Total Days Off:

2.0

Start Date:

07/01/2021

End Date:

07/02/2021

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ftapiaj39 

The above method is applicable when there is no content after end date or the content after the end date is fixed.

If the content behind end date is not fixed, you can try the following screenshots to get the date:

vLilyWmsft_0-1627882100542.png

Expression:substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Start Date:'), 11),12)

vLilyWmsft_1-1627882142079.png

Expression:substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'End Date:'), 9),12)

vLilyWmsft_2-1627882168681.png

vLilyWmsft_3-1627882212694.png

Hope the content above may help you.

Best Regards

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

 

 

View solution in original post

4 REPLIES 4
v-LilyW-msft
Microsoft
Microsoft

Hi @Ftapiaj39 

According to your description, you want to get the Start date and End date from email to create an event.

I created a simple Flow, you can refer to as below:

The flow is triggered by When a new email arrives, then convert the email body from Html to text.

vLilyWmsft_0-1627436506371.png

Expression: last(split(outputs('Html_to_text')?['body'],'Start Date:'))

vLilyWmsft_1-1627436506375.png

Get Start Date:

Expression:first(split(outputs('Compose'),'End Date:'))

vLilyWmsft_2-1627436506377.png

Get End Date:

Expression:last(split(outputs('Html_to_text')?['body'],'End Date:'))

vLilyWmsft_3-1627436506379.png

Create event with Start Date and End Date.

vLilyWmsft_4-1627436506382.png

When a new email arrive like this

vLilyWmsft_5-1627436506383.png

The new event will be created

vLilyWmsft_6-1627436506385.png

For more info about function you can refer to:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

Hope the content above may help you.

Best Regards

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

Hi,

Thank you for the help, but for some reason for the end date it is pulling the remaining part of the email instead of just the date.

Hi @Ftapiaj39 

The above method is applicable when there is no content after end date or the content after the end date is fixed.

If the content behind end date is not fixed, you can try the following screenshots to get the date:

vLilyWmsft_0-1627882100542.png

Expression:substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Start Date:'), 11),12)

vLilyWmsft_1-1627882142079.png

Expression:substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'End Date:'), 9),12)

vLilyWmsft_2-1627882168681.png

vLilyWmsft_3-1627882212694.png

Hope the content above may help you.

Best Regards

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

 

 

View solution in original post

It Worked! Thank you!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,375)