
Announcements
Hi, my first time posting here. It might be a relatively simple question but extensive googling couldn't give me an anwser (or I just didn't understand it).
So I'm trying to automatically create a bunch of events in my outlook calendar from a list. (exam dates and times for students). I think I got the flow down pretty well except I'm running into one problem. That is the below screenshot.
InvalidTemplate. Unable to process template language expressions in action 'Create_event_(V4)' inputs at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
So my question is, how do i make sure Get Items gives me string variables as outputs, or why does it give 0 results at all. I've used a similar structure with a scheduled flow where it worked without problems. Below are screenshots of the flow in editing mode. and expressions used
formatDateTime(items('Apply_to_each')?['Datum'],'yyyy-MM-ddTHH:mm:ss')
formatDateTime(items('Apply_to_each')?['Einde_tentamen'],'yyyy-MM-ddTHH:mm:ss')
Thank you very much in advance for taking the time to help me out.
Hi,
I guess your "End Date" is not mandatory in SharePoint list, so if it is not populated, you'll get null. you can't obviously expect Get Items giving another value than null in such case.
But you can check if empty before using formatDateTime() which expects a value.
if(empty(items('Apply_to_each')?['Einde_tentamen']), '', formatDateTime(items('Apply_to_each')?['Einde_tentamen'],'yyyy-MM-ddTHH:mm:ss'))
If I have answered your question, please Accept the post as solution.
If you like my response, please Thumbs Up.