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

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

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

Power Automate Video Tutorials

View solution in original post

Highlighted

 

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

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

Power Automate Video Tutorials

View solution in original post

Highlighted
Resolver II
Resolver II

@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

@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

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

Power Automate Video Tutorials
Highlighted

Hi @abm,

 

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

Capture.JPG

 

Highlighted
Super User III
Super User III

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

Power Automate Video Tutorials
Highlighted

Same error:

 

Untitled.png

Capture.JPG

Highlighted

@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

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

Power Automate Video Tutorials
Highlighted

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

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

Power Automate Video Tutorials
Highlighted

 

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

Guys, thank you all!


Now works as expected.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,824)