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

If a leave request is added or removed - update the calendar

PowerAppsFlow, PowerApps, Calendar, Calendar Event, calendar events, calendar view of events, leave, Request, flow, Flow When a new event is created (V2)

 

I'm trying to make a flow that creates calendar events from Leave Requests (powerapps) thats approved. 

I tried a few different setups, but havent had any luck making it work like i want it to. Please help!

I also want a flow for automatically deleting calender events when the leave request is deleted from powerapps (onedrive). I have no idea of how to make the delete flow. If you have the skills it would be much appreciated!

 

The goal is to always have the calendar up to date with the powerapps onedrive sheet.

 

This is what i got now:

Skjermbilde 2019-03-14 kl. 12.06.24.pngSkjermbilde 2019-03-14 kl. 12.06.44.pngSkjermbilde 2019-03-14 kl. 12.06.53.png

Its in Norwegian, but ill describe the different sources and commands below:

Recurrence - it runs the flow every hour.

Hent rader - "Get rows" in english. It gets the Leave request rows from a onedrive excel file.

Hent hendelser (V2) - "Get events (V2)" in english. It gets the events from the callendar called "Fravær" ("Leave" in english).

The two "Apply to each" boxes was added automatically. 

Filter array - Not shure if the right things are filled in here... It gets the information from "Value", i guess this is the values from the excel file. I then filled in that the "Status" should be equal to "Godkjent" (approved in english). The goal was to have it filter out (and use) the leave requests that was approved.

I dont know what "Selected" does, but i tested with and whitout it.. Don't work either way. Its the same values as in Filter array. 

Then its a new Applay to each which was added automatically. Dont know if its needed or not. 

New Filter array with calendar Value (guess this is all the values in that calendar), "Brødtekst" ("Body" in english) and "LeaveID". I decided to add LeaveID to the end of the body so i can use that as a uniqe id and refrense for not adding the same event multiple times. The goeal with this is to filter only the events (leaves) that havent been added before.  

last its the "Opprett hendelse (V2)" ("Add event (V2)" in english). It adds events to the calendar "Fravær". The title will be the requester and leave type. Start and end day are fetched from the excel sheet. The timesone is set to norwegian time, dont know if this is needed. "Brødtekst" (The body) contains leave title, details and ID at last (the ID is just in there so that I can refrense it as a filter (goal is to just have one event per leave). 

 

I did get it to add callendar events, but it added them all again the next hour. After 2 hours there were duplicates of all the events. After trying to add "Filter array" (I guess this is what i need to add) it would not create any calendar events and this is the status after running it:

 

Skjermbilde 2019-03-14 kl. 12.08.04.pngSkjermbilde 2019-03-14 kl. 12.08.19.png

Im lost and in desperate need of help. thanks!!

5 REPLIES 5
Community Support Team
Community Support Team

Re: If a leave request is added or removed - update the calendar

Hi @JAF ,

 

About #1, do you want to create calendar events from an Excel file with Approved status?

 

I have made the following flow for your reference. Instead of using Filter array and Select actions, I initialized variables in the flow. Please check the detailed configuration.

 

I am using Button trigger for testing, please just change it to a recurrence for your scenario.

 

  • In the action List rows present in a table, input the code status eq ‘Approved’ in the Filter Query field to filter out items that are Approved.
  • Initialize variable. Set its name as Events, Type as String.
  • Get events (V2) from Outlook calendar.
  • Add an Apply to each, select value from Get events. Add action Append to string variable, set its value as dynamic content Subject from Get events (V2).
  • Add a Condition, set its as variable Events doesn’t contain name (dynamic content from action List rows present in a table).
  • Under if yes branch, create event (V2) on specific calendar with detailed info.

1.PNG2.PNG3.PNG

 

About #2, to create a deleting flow, we could use the similar configuration but an opposite logic. Please check the following configuration.

4.PNG5.PNG6.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.
Highlighted
JAF
Level: Powered On

Re: If a leave request is added or removed - update the calendar

@v-yamao-msft Thanks for the help. Im still having a small problem. Looks like its the dates.. In the excel form the date cells are set to dd.mm.yyyy hh.mm (custom). I dont want to change the excel form due to the coding with powerapps. But if i have to, i will. Tried to make a copy of the excel form and use simple dates, but the flow would still not work. Please help. 

 

Related pictures:

Skjermbilde 2019-03-19 kl. 10.21.06.pngSkjermbilde 2019-03-19 kl. 10.21.12.pngSkjermbilde 2019-03-19 kl. 10.30.35.png

 

I think the Delete flow works. Didnt get error, but havent deleted anything from the excel sheet yet. 

JAF
Level: Powered On

Re: If a leave request is added or removed - update the calendar

@v-yamao-msft please tell me if you are having troubles with the attatched photos. Had a error msg when uploading them. 

 

Thanks!!

JAF
Level: Powered On

Re: If a leave request is added or removed - update the calendar

@v-yamao-msft 

Have you had time to look into this? 

Thanks!

Community Support Team
Community Support Team

Re: If a leave request is added or removed - update the calendar

Hi @JAF ,

 

It’s a known issue that date from Excel will be returned as a String when working with Flow.

 

A workaround for this issue format the StartDate and EndDate columns as Text first, then input the date and time in each row.

 

Further, it should be set to a ISO format likes below:

1.PNG

 

Doc on ISO 8601 for your reference:

https://en.wikipedia.org/wiki/ISO_8601

 

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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 110 members 3,329 guests
Please welcome our newest community members: