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

Prevent double booking SharePoint calendar for the day

The goal of the flow is to prevent double cooking if the category has been assigned for the day (no need to check time) of the calendar. This is what I have so far. If the category is chosen, do not save the item, send email about the double booking.

 

So for example, April 10, 2019, Category = Meeting then someone trying to book again for the same day and trying to choose Category = meeting, do not save, send email.

 

condition.jpg

 

Thanks for the help.

15 REPLIES 15
Community Support
Community Support

Hi @normmsnpoweruse ,

 

Do you want to check if the selected category already exists or not? If it already exists (for the same day), delete the newly added one and send an email, stopping double booking.

 

I have set up the flow likes below. In the following scenario, I am going to check the booking for the same day and stop duplicate booking for one category.

 

Add trigger When an item is created or modified. Manually enter the name of the calendar list.

 

Add action Get items, input the code likes below in the Filter query field to filter out events that start on the same day and with the same category.

 

Then add a Condition with following code:

 

length(body('Get_items')?['value'])

is greater than

1

 

Under if yes branch, add action Delete item. Make sure select dynamic content ID from the trigger.

1.PNG

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for this reply. I followed your flow but somehow, the yes condition is not working. Section value is a lookup field.

lookup.jpg

The yes condition is working now but the original copy is the one getting deleted. I double checked the correct ID is used.

Looks like I got some parts to work now but I am having an issue with infinite loop of flow for the NO condition since an Update Item action is considered "MODIFIED" so it will go to the top and run the flow again and again.

I think the condition is not working because it is deleting all the entries for the day.

2.jpg

Hi @normmsnpoweruse ,

 

Thanks for updating.

 

In the action Delete item, please make you select the dynamic content ID from the trigger, then it will only delete the newly created one when the condition match.

 

If you want to update item under If no branch, to get rid of an infinite loop, pleas change the trigger to “When an item is created”.

 

I have made another test and it does work as expected.

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for this reply. I got this create item trigger to work but the problem is when a user modify an item, this trigger..

Hi @normmsnpoweruse ,

 

I guess that you are using the trigger “When an item is created or modified”. If so, the flow will be triggered whenever a new item is created or an existing item is modified.

 

I suggest use the trigger “When an item is created” so that the flow won’t be triggered when the existing items are updated/modified.

 

Hope this make sense.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

because create or modified triggers are required to make sure no double booking of the section or category.

Hi @normmsnpoweruse ,

 

I got it. How about removing the action Update item?

 

Without using the action Update item, the flow won’t be triggered infinitely.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I looked at it but it is a band-aid solution, not a permanent one. I don't understand, this problem has been going on for more than ONE year so why can't MS just create a separate trigger for the creation and for modification respectively?

Hi @normmsnpoweruse ,

 

Yes, currently Flow doesn’t have a trigger for When an item is modified only.

 

There is a similar request on Flow Ideas Forum, please vote the idea at here:

https://powerusers.microsoft.com/t5/Flow-Ideas/Trigger-flow-When-Item-is-Modified-only/idi-p/237883?...

 

I will help report this issue as well. PGs will take hot ideas into consideration first, hope it could be taken into consideration in future releases.

 

Thanks for your understanding.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I just got out of the meeting with the MS Premier Support. They were able to duplicate the infinite loop but could not come up with a workaround. They could not explain either the reason for the Flow Production team nuking the modified trigger only to merge create or modified into one trigger. I told them that this bug has been going on for years now and it seems MS just ignored - they just apologized!

 

Anyway, the Premier Support team is in contact with the Flow Production team but no estimated time for a resolution.

Hi @normmsnpoweruse ,

 

Thanks for updating and sharing.

I really appreciate your efforts.

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Actually, your first reply works only to check for duplicate after adding an item within a few minutes on the same day but if you add a new item for the same date a day later, the condition will return false even there is a duplicate category. I think it is due to the fact, it is checking the time of the event date? Is it possible just check the date without time without changing the Start date column to Date only?

 

Getitem.jpg

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (68,494)