Hello,
I would like to ask for help with formatDateTime function.
I want to transform recieved e-mail to Planner application. Everything works well except date for Due date field.
We have an e-mail template, where is a dedicated row which contain word "Termín" ("Date" in english) and after this word is placed a date. This date is taken as a Due date in Planner.
My problem is, that people in our company are used to use the date in format dd.(M)M.yyyy (eg. 13.7.2021), so I need to convert this date to ISO 8601 format.
I wanted to use function formatDateTime and convert it to format yyyy-MM-dd (eg. 2021-07-13).
But even I tried everything what I found, the results is still the same.
"Unable to process template language expressions in action 'Compose' inputs at line '1' and column '31949': 'In function 'formatDateTime', the value provided for date time string '15.07.2021' was not valid. The datetime string must match ISO 8601 format.'."
The weird fact is, that my flow works well 2 months ago, and I did not change anything in the flow.
Could anyone help me please?
My whole flow:
"Inicializovat proměnou 2" value: last(split(variables('EmailBody'),'Termín:'))
"Inicializovat proměnou 3" value: first(split(variables('EmailLast'),'<'))
"Due date" field value in Create task: if(contains(variables('EmailBody'),'Termín'),formatDateTime(variables('EmailFirst'),'yyyy-MM-dd'),getFutureTime(7,'day'))
Thank you in advance.
Libor
Solved! Go to Solution.
split(variables('varInputDate'),'.')
concat(variables('varSplitDate')[1],'.',variables('varSplitDate')[0],'.',variables('varSplitDate')[2])
Ellis
split(variables('varInputDate'),'.')
concat(variables('varSplitDate')[1],'.',variables('varSplitDate')[0],'.',variables('varSplitDate')[2])
Ellis
Hi ekarim2020,
Thank you very much for quick and great solution.
I had a few problems with settings, but now is everything ok and flow works as I expect.
Could I just ask, if the formatDateTime required a format MM.dd.yyyy for the whole time or if it was changed in the latest update? I ask, because few month ago, my flow worked alright even without your solution.
Thank you again.
Libor
I don't believe that the formatDateTime function has changed in anyway.
This leads me to suspect that the source data (the time string) has changed in some way: the e-mail template??
You may be able to obtain some useful info from the flow's 28-day run history, comparing when the it ran successfully before it "broke" to when it started to fail. Compare the old time string from the e-mail template to the current one.
Ellis
User | Count |
---|---|
27 | |
16 | |
15 | |
12 | |
11 |
User | Count |
---|---|
43 | |
30 | |
28 | |
24 | |
23 |