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

How to get the date values from the email subject

I am trying to build a Flow that will block the calendar (create an all day event) for the dates received in email subject

 

Email subject format:
Email confirmation for Leave - holiday 01.12.2020 - 02.12.2020

 

Any idea how to split the subject and to retrieve the date values from the subject?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

Use the below split expressions

 

trim(first(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
trim(last(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
 
image.png
 
Test Result
 
image.png

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

Highlighted
Community Support
Community Support

Re: How to get the date values from the email subject

 

Hi @jeneaMD ,

 

Please try the following expression to change the format of the date to the expected one.

Image reference:

115.PNG

concat(split(outputs('Compose'),'.')[2],'-',split(outputs('Compose'),'.')[1],'-',split(outputs('Compose'),'.')[0])

 

Best Regards, 

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

13 REPLIES 13
Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

Use the below split expressions

 

trim(first(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
trim(last(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
 
image.png
 
Test Result
 
image.png

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

Highlighted
Resolver II
Resolver II

Re: How to get the date values from the email subject

@jeneaMD 

 Everything is much like hardcode, but I test your subject, it worked.

 

Flow.png

 

 

split(split(outputs('Email_Subject'), 'holiday ')[1], ' - ')

Result will be :
[
  "01.12.2020",
  "02.12.2020"
]
formatDateTime(outputs('Compose')[0]) -> 2020-01-12T00:00:00.0000000
formatDateTime(outputs('Compose')[1]) -> 2020-02-12T00:00:00.0000000

 

 

Result of "Create event (V4)"

Result.png

 

Highlighted
Helper II
Helper II

Re: How to get the date values from the email subject

@abm , thank you!

 

@MinRao,  I've replicated exactly what you showed, but I have this error:

 

 

 

Capture.JPG

 

Any idea what should I do?

 

Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

 

Both of our suggestion should work. Check your run history of the compose. Make sure it is returning both dates.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Helper II
Helper II

Re: How to get the date values from the email subject

Hi @abm,

 

I checked and it looks ok. I have both dates from Compose actions:

Capture.JPG

 

Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

Try the following expression


formatDateTime(outputs('Compose')[0], 'yyyy-MM-dd')

 

formatDateTime(outputs('Compose')[1], 'yyyy-MM-dd')



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Helper II
Helper II

Re: How to get the date values from the email subject

Same error:

 

Untitled.png

Capture.JPG

Highlighted
Resolver II
Resolver II

Re: How to get the date values from the email subject

@jeneaMD 

 

Please check your compose did return array like following, it seems string was return.

 

result-1.png

 

Also, following is my flow, you can download for check.

 

https://hsladesa.blob.core.windows.net/temp/CreateAllDayEventFromEmailSubject_20200517161307.zip?sp=...

* this link will expired after 5/19

 

Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

Could you please using my suggestion and let me know? Also please post a screenshot of the compose output.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Helper II
Helper II

Re: How to get the date values from the email subject

Thank you for your reply, @abm.

 

For 01.12.2020 - 02.12.2020 Flow works correctly, but for other dates it doesn't work properly.

For example: 19.05.2020 - 20.05.2020, I have an error:

Capture.JPG

Although the "Compose" actions works fine:

1.JPG

 

 

Highlighted
Super User III
Super User III

Re: How to get the date values from the email subject

Hi @jeneaMD 

 

I did tried the below and worked for me as expected.

 

image.png

 

Compose First Date

trim(last(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
Compose Second Date
trim(last(split(last(split(outputs('Compose_2'),'holiday')),'-')))
 
Create Event - Expression formats ofstart and end time as follows:
 
formatDateTime(outputs('Compose_First_Date'), 'yyyy-MM-ddThh:mm:ss')
formatDateTime(outputs('Compose_Second_Date'), 'yyyy-MM-ddThh:mm:ss')
 
Thanks
 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Community Support
Community Support

Re: How to get the date values from the email subject

 

Hi @jeneaMD ,

 

Please try the following expression to change the format of the date to the expected one.

Image reference:

115.PNG

concat(split(outputs('Compose'),'.')[2],'-',split(outputs('Compose'),'.')[1],'-',split(outputs('Compose'),'.')[0])

 

Best Regards, 

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper II
Helper II

Re: How to get the date values from the email subject

Guys, thank you all!


Now works as expected.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (9,443)