cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sbibbco
Helper I
Helper I

AMA: Flow error

I am getting the following error when attempting to get date and time items from a SharePoint list - Unable to process template language expressions in action 'Get_items' inputs at line '0' and column '0': 'The template function 'formatDateTimeutcNow' is not defined or not valid.'.

1 ACCEPTED SOLUTION

Accepted Solutions
cwebb365
Super User
Super User

No, you're missing the apostrophe like I said to add. See screenshot. Also remove leading space. 

Screenshot 2022-03-15 115234.jpg

View solution in original post

29 REPLIES 29
cwebb365
Super User
Super User

Based on the error looks like your function is not correct. Could you screenshot or paste in the actual expression used? Should be like formatDateTime(utcNow(),'YYYYddmm') etc. 

sbibbco
Helper I
Helper I

sbibbco_0-1647359106893.png

 

Click on the actual formatedate time box, it should show the code of that entry. 

sbibbco
Helper I
Helper I

sbibbco_0-1647359343442.png

 

Change that code to formatDateTime(utcnow()) and you should be good. 

getting - InvalidTemplate. Unable to process template language expressions in action 'Get_items' inputs at line '0' and column '0': 'The template function 'formatDateTimeutcNow' is not defined or not valid.'.

errr, I mean just use utcnow() if that doens't work then formatdatetime(utcnow(),'YYYY-dd-MM') if you need a certain format for some reaosn. But you can shift those letters around, but just using utcnow() should work. You might need to account for timezone if time is involved, but if you are just using days then it should be good. 

Make sure to click update and when you open it back up it should have the change in it etc. 

Ok, changed and clicked update. But getting this error {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"ScheduledDateTime ge ' 2022-03-15T15:58:33.6938684Z\" is not valid."}}}

use the full formatDateTime(utcnow(),'MM-dd-yyyy') is this a date only filter or is time considered? 

sbibbco
Helper I
Helper I

Ok, thus is a date only field 

sbibbco_0-1647360391171.png

 

I don't know your date format where you are, if it's in USA and standard MM-dd-yyyy then you might want to use that in the string, but format it to your locale. 

OK, just saw your screenshot there, use my last reply formateDateTime(utcNow(),'MM-dd-yyyy') should work. 

sbibbco
Helper I
Helper I

{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"ScheduledDateTime ge ' 03-15-2022\" is not valid."}}}

Ok, sorry for multiple responses, but change to this

convertFromUtc(utcNow(),'Central Standard Time','dd-MM-yyyy')
 
You will want to get the Text for your timezone and change it. Mine is Central. But this link has the official names. 
 
This will make sure you have the date using the right timezone. 
 
As for the error, you need to add a ' at the end in the Filter part of the SharePoint action. you have the ' to start, but need to arrow past the expression box and add another ' so it's surrounded with '' 
sbibbco
Helper I
Helper I

Still getting {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"ScheduledDateTime ge ' 15-03-2022\" is not valid."}}}

after adding 

convertFromUtc(utcNow(), 'Eastern Standard Time','dd-MM-yyyy')

use 'MM-dd-yyyy' 

Also once changed, please screenshot the trigger, seems there is a space after your first ' and still seems missing after the expression box as it don't show in the error? 

sbibbco
Helper I
Helper I

convertFromUtc(utcNow(),'Eastern Standard Time','MM-dd-yyyy')
 
sbibbco_0-1647362837058.png

 

sbibbco
Helper I
Helper I

Is it because there are multiple entries for the same date?

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,641)