cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RSAndrews94
Level: Powered On

When an event is updated I want to either delete and create a new event or update and existing one

Hi,

 

I'm trying to figure out how to create a flow which reads when an event is updated in google Calendar, and then finds a related event and either deletes it and creates a new one, or updates the existing one.

I have tried a few different things but when ever I try and update or delete event2 it comes up with an error saying the event could not be found.

 

Example 1:

"Surgery 'Variable1'" event1 is updated

get event2 containing "Dispatch 'Variable1'"

Delete event

create new event3

read date event1 has been updated to add new event3 a set amount of days before

 

Example 2:

"Surgery 'Variable1'" event1 is updated

get event2 containing "Dispatch 'Variable1'"

 

Update event2

read date event1 has been updated to and update the day event2 is on.

 

Thanks in advance for any help

2 REPLIES 2
Highlighted
Community Support Team
Community Support Team

Re: When an event is updated I want to either delete and create a new event or update and existing o

Hi @RSAndrews94,

 

Could you please show a bit more about the "Surgery 'Variable1' " and the "Dispatch 'Variable1' " that you mentioned?

Could you please share a screenshot of your flow's configuration?

Further, how do you find the related event within your flow?

 

I suppose that you want to find the related Google calendar event whose Title has the key value Dispatch Variable1 within your flow, delete the related event and create a new event or update the existing one. Is it true?

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When an event is updated in calendar" trigger.
  • Add a "List the events in calendar" action, Min Time field set to following formula:

 

utcNow()

 

  • Add a "Apply to each", input parameter set to output of "List the events in calendar"
  • Within "Apply to each", add a Condition, left input box set to Event List Event Title dynamic content of the "List the events in calendar" action, right input box set to Dispatch Variable1.

         Within "If/yes" branch of Condition, add a "Delete an event" action and then add a "Create an event" action.

 

Note: The variable1 of key value "Dispatch Variable1" is not wrapped with single quotation (') on my side, if I remain the single quotation, when I click "Edit in advanced mode", the variable1 would be wrapped with double quotes automatically:19.JPG

But the variable1 that the google calendar event contains is wrapped with single quotation, so the result the Condition box evaluates would be false continuously.

 

The single quotation mark is the only way to wrap string literals within expressions of Microsoft Flow, you cannot use double-quotes inside expressions because this punctuation conflicts with the JSON quote that wraps the whole expression. 

 

Image reference:16.JPG

 

17.JPG

The flow works successfully as below:18.JPG

 

If you want to find the related event via condition that I provided above, please remove the single quotation which wraps the variable1.

 

 

Best regards,

Kris

 

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RSAndrews94
Level: Powered On

Re: When an event is updated I want to either delete and create a new event or update and existing o

Hi @v-xida-msft,

 

So the variable isn't really a variable defined in the flow, it is just a code which is different for each Surgery date, and then using a different flow, I have made one which creates an event replacing SURGERY with DISPATCH.example calendar flow output.JPGWhen I add an event containing SURGERY, it creates a Dispatch date a set number of days beforeAdd dates working.JPGThis is the flow which adds the eventsDelete event.JPGIn this one I'm trying to find the event which has the DISPATCH, but also has the same ending as the one which was updated

The dynamic function I'm using in the last image is this: 

replace(triggerBody()?['summary'],'SURGERY','DISPATCH')
 
Even just getting an event it gives the correct input, but it gives an error message saying it couldn't be found.
Has the correct input name.JPGFinds the correct input name, but it gives an error 404 message saying it can't be found
Using the example you suggested it still comes up with the same error messageFlow failed.JPG
 
It just seems odd that it has the correct input name but then can't find the event in the calendar.
Hopefully you can make some sense of what I'm trying to do
 
Best Wishes
 
Robyn

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 335 members 6,964 guests
Please welcome our newest community members: