cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cjwilson1009
Frequent Visitor

Create Event (V4) with SharePoint List Date and Time (Start Date & Time + End Date & Time)

I have a PowerApp that I'm using for Event / Class Registrations. When someone registers for an event or class, it creates an item in our SharePoint list. I have a PowerAutomate Flow created that runs when a new item is created in the SP List and sends an email to the person who registered for the class, and then subsequently creates an event for the class in their outlook calendar.

 

However, I'm running into errors when trying to pass the Start Time & End Time from the SharePoint list. I got the following error message:

 

Unable to process template language expressions in action 'Create_event_(V4)' inputs at line '1' and column '32820': '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.'.

 

And sometimes, if I don't use anything to convert the date and time, I will get this message while trying to save the flow:

 

Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'item' validation failed in workflow operation 'Create_event_(V4)': The parameter with value '"@items('Apply_to_each')?['EventStart']"' in path 'item/start' with type/format 'String/date-time' is not convertible to type/format 'String/date-no-tz'.'.

 

The flow won't simply allow me to add the item from 'Get Items', "EventStart, and EventEnd." It's not formatting correctly. In addition to this, when the flow does run (if I use a generic date and time for start and end), it creates 3 duplicate events in the user's calendar when it should only be creating it one time.

 

Here is the flow I have so far:

cjwilson1009_0-1627492941737.png

 

I've tried using the following expressions to get the date / time to format: 

triggerOutputs()?['body/Start']
convertToUtc(triggerOutputs()?['body/start'], 'Eastern Standard Time')

and

convertToUtc(triggerOutputs()?['body/start'], 'GMT Standard Time')

but none of these seem to work, and I still get an error, and if I don't get an error, it still creates the same even 3 times.

One of the expressions above worked, but it didn't create the event on the date and time it is set for in the list, it created the event for the same day I registered for the event. *** We are using Central Standard Time ***

 

This is what the date and time look like in the SharePoint List:

cjwilson1009_1-1627493148617.png

 

 

I hope this makes sense, but I don't know where else to go.

6 REPLIES 6
PrasadAthalye
Super User
Super User

From your error, I can see that you are using formatdatetime but in your flow screenshot, I dont see any such function. Can you please confirm where in the flow you are using this function? It seems it is getting null value.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi,

Here is the example where I'm using this: 

triggerOutputs()?['body/Start']

However, this creates the calendar event the same day I register, instead of the actual session date/time. It also creates 3 duplicate events.

 

cjwilson1009_0-1627493988834.png

 

I tried using this to format the EventStart and EventEnd time: formatDateTime(item()?['EventStart'],'dd/MM/yyyy') and got the following error:

cjwilson1009_0-1627663378946.png

 

FYI - The dates in Sharepoint are both Date / Time fields. So there is also a time included, which I can't seem to get to work either ;(

 

 

Can you please format using following format?

 

formatDateTime(item()?['EventStart'],'yyyy-MM-ddTHH:mm:ss')
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
cjwilson1009
Frequent Visitor

Thank you, but unfortunately, I still get the following error:

cjwilson1009_0-1627918508784.png

Do I need to put the same function in for the EventEnd (End Time) too, or just the Start Time?

cjwilson1009_1-1627918565879.png

 

Yes. You will have to use function for both start and end. 

 

In your recent screen shot, I dont see a loop. What happened to loop? Are you getting these dates from trigger action? If yes, can you select those from dynamic content?

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,244)