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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to process temp...
Power Automate
Unanswered

Unable to process template language expressions in 'formatDateTime'

(1) ShareShare
ReportReport
Posted on by 53

Hi

 

Have set up an excel table in sharepoint with dates for mid, final and extended probation's of staff, added additional columns showing reminder dates at 7 days before, 1 day before etc created individual flows  that reads the date in the appropriate reminder columns, compares to today's date and send e-mail reminder to those who need to carry out the reviews if the date matches, so have 6 flows as below

 

Extended Probation 1st Reminder
Extended Probation Review 2nd reminder
Mid Probation 1st Reminder
Mid Probation 2nd Reminder
Final Probation 1st Reminder
Final Probation 2nd Reminder

 

They were all created as copy's of each other (as after creating the first one and it working I just copied and amended the columns to read from), but only 2 of them work, (Mid Probation 1st Reminder and Mid Probation 2nd Reminder) the other 4 all fail with the following error

 

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '0' and column '0':
'In function 'formatDateTime', the value provided for date time string '45672' was not valid.
The datetime string must match ISO 8601 format.'.

 

Below is the working formulas for the "Mid Probation 1st Reminder" and "Mid Probation 2nd Reminder" as an example

 

formatDateTime(items('Apply_to_each_4')?['Mid Reminder Date 1 (7 Days)'],'dd/MM/yyyy')
formatDateTime(items('Apply_to_each_4')?['Mid Reminder Date 2 (1 day)'],'dd/MM/yyyy')

 

For all the others I have just copied the above and changed to the relevant columns needed from the table (as per below), but they all fail

 

formatDateTime(items('Apply_to_each_4')?['Final Reminder Date 1 (7 Days)'],'dd/MM/yyyy')
formatDateTime(items('Apply_to_each_4')?['Final Reminder Date 2 (1 day)'],'dd/MM/yyyy')
formatDateTime(items('Apply_to_each_4')?['Extended Date 1 (7 days)'],'dd/MM/yyyy')
formatDateTime(items('Apply_to_each_4')?['Extened Date 2 (1 day)'],'dd/MM/yyyy')

 

The table is all formatted exactly the same for all the dates (screenshot below), so I'm scratching my head as to why 2 work, but 4 don't?

 

richardj5_0-1720518112041.png

 

Any help appreciated

 

Thanks

 

Categories:
I have the same question (0)
  • richardj5 Profile Picture
    53 on at

    Fixed it myself, flow did not like the blanks in the table, entered fictional dates of 01/01/2099 and all are now working  😁

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    @richardj5 Great work !

  • richardj5 Profile Picture
    53 on at

    Well I thought it was fixed, the tests ran successfully,  but the automated runs bought back the same error?

     

    richardj5_1-1720594083144.png

     

     

    richardj5_0-1720594058227.png

     

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    Hey @richardj5 

     

    Thanks for your response. can you please share the whole workflow?

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and Mark it as a Solution 🎉 .
    Sayan Patra

    RPA Developer

  • richardj5 Profile Picture
    53 on at

    Hi

     

    One of the failed flows below, all worked when tested yesterday, 3 worked automatically this morning and 3 failed, no changes made to the spreadsheet/table overnight and all the flows are copy's of each other with just formula in the condition amended on each one to read the correct column in the spreadsheet?

     

     

    richardj5_0-1720595912858.png

     

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    Hi @richardj5 Thanks for sharing the workflow.

     

    In the condition where you are checking the date, an error occurs because the date is not in a valid format. Please check the Data is in Valid format or not.

     

    Have you checked whether the formatDate function gives the correct output?

    There are some empty rows and N/A in the Excel sheet. Please add a condition to skip the empty rows.

     

    Also, if possible, can you please share what you are actually trying to do? I am a bit confused. If I get more clarity about it, it will be easier to solve the problem.

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and Mark it as a Solution 🤖.

     

    Thanks,

    Sayan Patra

    RPA Developer

     

  • richardj5 Profile Picture
    53 on at

    Hi

     

    As in original post, trying to read a date from spreadsheet in SharePoint, if date matches today's date email is sent.

     

    I also believed it was caused by the blanks and N/A's in the file, as when dummy dates added test run worked fine yesterday

     

    richardj5_2-1720608833149.png

     

     

    richardj5_0-1720608449656.png

    But auto run this morning failed?

     

    richardj5_1-1720608517190.png

     

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    Hey @richardj5 

     

    can you please share the dummy data and inside the condition what is the expression you have written?

    Are you using new designer or Classic Designer ?

     

    I can see that there is 89 rows in the sheet. can you please In the for each check that what the error coming?

     

    ------------------------------------------------------------------------------------------------------------------------------If my suggestion helped you, please give it a Thumbs up and Mark it as a Solution.

    Thanks,

    Sayan Patra

    RPA Developer

     

  • richardj5 Profile Picture
    53 on at

    Hi

     

    Employee probation spreadsheet attached (names removed for confidentiality) 

     

    Condition for the failed flows when auto ran (succeeded when tested manually)

     

    formatDateTime(items('Apply_to_each_4')?['Extended Date 1 (7 days)'],'dd/MM/yyyy')
    formatDateTime(items('Apply_to_each_4')?['Extended Date 2 (1 day)'],'dd/MM/yyyy')

     

    Error in the for each when flow failed

     

    richardj5_0-1720616034189.png

     

    Versus successful flow run (all outputs false as no dates matched to today's date)

     

    richardj5_1-1720616100718.png

     

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    Hey @richardj5 

     

    Finally, the issue resolved!

    The issue is caused due to the Date Format. 

    In Power Automate Cloud, the date format "45678" corresponds to an Excel serial date number. To convert this serial number to a date in Power Automate Cloud follow the following solution - 

     

    Solution: 

     

    Step 1:

    Initialize Variable which holds the Today () Date  

    Sayan_0-1720620815381.png

    Sayan_1-1720620825655.png

     

    Step 2:

    Read the Date Using Action "List rows present in a table

     

    Step 3:

     

    Use Apply to each

    Sayan_2-1720620927327.png

    inside for-each use a condition 

    Sayan_3-1720620975831.png

     

    Sayan_4-1720620990319.png

    addDays('1899-12-30', int(item()?['Mid Reminder Data']), 'dd-MM-yyyy')

    use the above expression on the Right-hand side to convert the Excel Data to a Date Format. 

    In Power Automate Cloud, you can use the addDays function to convert the Excel serial date number to a readable date.  

     

    addDays('1899-12-30', 45481, 'yyyy-MM-dd')

    This formula will convert the serial number 45481 to the date 2024-07-08.

     

    Main WorkFlow:

     

    Sayan_5-1720621270299.png

     

     

     Hope It will solve the issue!

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helped you, please give it a Thumbs up 👍 and Mark it as a Solution 🤖. This motivates me to solve more problems.

    Thanks,

    Sayan Patra

    RPA Developer

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 506 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 425 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard