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

Creating all day event in Sharepoint from approve/reject flow

Hi all,

 

I've created a flow for employee vacation requests using the approve/reject flow. When a request is approved, it adds the employees vacation to a calendar on SharePoint. This is easy enough, however the blocked off time on the calendar is always short by one day as the events are automatically created to 0h. So if someone has an approved request from June 11-14, only 11-13 will be blocked off on the calendar under their name. I really don't want employees to have to select time alongside date (i.e. June 11 00:00 to June 14 23:55) when booking vacation, since it's always full days.

 

I've tried the below solution, but know I'm missing something. I also tried running a script on the SharePoint list itself to automatically default new calendar event entries as "all day" but this is not being recognized from the flow that creates said entries. I'm newer to Flow, so go easy!

 

FlowExample.png

 

Any guidance would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Mabel,

 

Thank you for looking into this and for the detailed response. The issue you've ran into on the calendar is the issue I'm referring to. I mentioned not wanting employees to input time as a reference to this (i.e. if they put 23h 55m on the 'End Date' then the calendar issue would be solved). I've found a solution to all of this by writing some Jquery that applies 0h 0m to 'Start Date' and 23h 55m to the 'End Date' automatically, and then hides the time columns. Now the calendar is issue is fixed and everything is working as intended.

 

Edit: I've added the script here incase others are having the same issue:

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
$('[id ^=Start][id $=DateTimeFieldDateHours]').hide();
$('[id ^=Start][id $=DateTimeFieldDateMinutes]').hide();
$('[id ^=End][id $=DateTimeFieldDateHours]').val(23).hide();
$('[id ^=End][id $=DateTimeFieldDateMinutes]').val(55).hide();
});
</script>

 

Cheers!

View solution in original post

8 REPLIES 8
v-yamao-msft
Community Support
Community Support

Hi BuzzwordMaster,

 

According to your description, I create a flow looks like below.
When an item created on ListC is approved, it will be created on the Leave Request list(Calendar list).

3.PNG

 

Then I create an item on ListC to run the flow, the vacation is from 4.17-4.20.
While the item created on Leave Request list is 4.17-4.19. See the screenshot below.
I will report this issue on my side and back to you once I got any response.

1.png

 

About this sentence “I really don't want employees to have to select time alongside date (i.e. June 11 00:00 to June 14 23:55) when booking vacation, since it's always full days”, how do you configure the Date and Time column?
Please try to configure its format as “Date Only”, then the employees will not have to select time alongside date.
Please try if this works for you.

4.PNG

 


Best regards,
Mabel Mao

 

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.

Hi Mabel,

 

Thank you for looking into this and for the detailed response. The issue you've ran into on the calendar is the issue I'm referring to. I mentioned not wanting employees to input time as a reference to this (i.e. if they put 23h 55m on the 'End Date' then the calendar issue would be solved). I've found a solution to all of this by writing some Jquery that applies 0h 0m to 'Start Date' and 23h 55m to the 'End Date' automatically, and then hides the time columns. Now the calendar is issue is fixed and everything is working as intended.

 

Edit: I've added the script here incase others are having the same issue:

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
$('[id ^=Start][id $=DateTimeFieldDateHours]').hide();
$('[id ^=Start][id $=DateTimeFieldDateMinutes]').hide();
$('[id ^=End][id $=DateTimeFieldDateHours]').val(23).hide();
$('[id ^=End][id $=DateTimeFieldDateMinutes]').val(55).hide();
});
</script>

 

Cheers!

View solution in original post

I dont have issue updating the SP calendar with all day event. But maybe because I'm using a custom list with calendar view not an actual SP Calendar? My issue was with Outlook when the event is all day, the create event action changes my time zone to utc 0, and im at -7 (PDT). I used compose and startOfDay function to set my dates to midnight for the [create event] action

 

On SharePoint:
All Day Event = Yes

Start Date: 04/13/2017

End Date: 04/13/2017

Outlook Calendar

Compose: Start Date -- "@startOfDay(triggerBody()?['EventDate'])"

Compose: End Date -- "@startOfDay(adddays(triggerBody()?['EndDate'], 1))

 

Tamras - I tried using the @ functions prior to having to go with script, and I came to the conclusion that because Flow treats outlook calendar entries as 'events' it's not an issue. With SharePoint however, because it's updating an 'item' and the calendar is a 'list', I was unable to use the @ functions (I could be mistaken though).

 

 

AngelinaSpring
Helper I
Helper I

Hi Buzzword Master

 

I'm struggling with getting Sharepoint to add my event to the site calendar, after approval.

Can you share the details of this part of your flow so that I can try to replicate for my system please?

 

Thank you!

@BuzzwordMaster ,

 

where I put this code?? Could you explain???

@BuzzwordMaster 

 

Even I'm facing this issue, got stuck for a long time and reached this post, but where should I add this code, could you please provide details.

How can I add the code to the sharepoint calendar?

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (2,796)