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

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
BuzzwordMaster
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

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
Community Support Team
Community Support Team

Re: Creating all day event in Sharepoint from approve/reject flow

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.
BuzzwordMaster
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

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

Tamras
Level 10

Re: Creating all day event in Sharepoint from approve/reject flow

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))

 

BuzzwordMaster
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

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
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

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!

hiranfilho
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

@BuzzwordMaster ,

 

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

medasbabu
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

@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.

roxyshenton
Level: Powered On

Re: Creating all day event in Sharepoint from approve/reject flow

How can I add the code to the sharepoint calendar?

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

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 Solution Authors
Top Kudoed Authors
Users online (5,412)