Hello! I am struggling with my frist flow and decided to stop lurking and post in hopes I can get some guidance on how to accomplish these requirements.
I have a sharepoint list for vacation requests and when an employee puts in a vacation request, the first part of flow should notice the item creation, validate the list item that it abides by the rules listed below.
1. Two weeks notice required
2. Nobody else has vacation on the Sharepoint list during the same period.
If none of these rules are violated, add to the vacation shared calendar.
If a rule is violated, send approval email to manager with approve or deny. Based on response, add to calendar and send confirmation email to employee if approved. If denied, change the sharepoint list submission to show the denied response to the list item.
If the sharepoint list is modified repeat the process to ensure rules are still being passed correctly and resend approval email if rule violated. Modify calendar event as well including removal if the sharepoint list item is deleted.
All that being said, I have been able to send approval emails based on the templates included as well as create a calendar item from the sharepoint list. I have made validation rules using infopath 2013 for 2 weeks notice requirement but validation from my experience thus far prevents data from being submitted which isn't what I want. Just an approval email to be triggered.
Thanks for posting.
For the rules.
The first one is easy to configure under Microsoft Flow, what we need to do is to use the Adddays function with UTCnow() to compare with the StartTime of the Vacation,
If Adddays(utcnow(),14,'yyyyMMdd') is less than formatDateTime(StartTime,'yyyyMMdd'), then the rule is meet, otherwise, send the approval.
For second rule, which is a little hard to deal with.
First we need to use Sharepoint ->Get items Action, then use the Filter Array action, Under the filter array action condition, compare the Start/End time with the one from the trigger.
Here we use StartTime1, EndTime1 to represent the value from the Get items data, and StartTime, EndTime to represent the value for newly created item,
The logic to check if there are poeple have vocation in the same time range should be:
Switch to Formula, it should be:
Or( And(LessOrEquals(StartTime, StartTime1), Less(StartTime1,EndTime) ), And(Less(StartTime, EndTime1), LessOrEquals(EndTime1, EndTime) ) )
After the Filter Array action, if we would like to check if there is anyone have the same vocation requests, we could check if the Filter Array Action is empty, if empty, then the rule is meet.
Formula should be:
So the final condition to check, should be:
@And( lessOrEquals(Adddays(utcnow(),14,'yyyyMMdd'), formatDateTime(StartTime,'yyyyMMdd')), Empty(Body('Filter_Array')) )
For the corresponding Action, please add it to the Yes or No part accordingly.
Post back if you have any further questions.
Three Super User rank tiers have been launched!
Features releasing from October 2020 through March 2021
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!