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

Leave Request Customization

Hello PowerApp experts,  I have created an app using 'Leave Request' template.  I would like to customise the leave types, its balance for my organisation. Is there a way to do it? if yes, please guide me to it. The steps mentioned in https://powerusers.microsoft.com/t5/General-Discussion/PowerApps-Template-Leave-Request/td-p/191780 is not too much clear to me. Thank you, Regards, Meera.

1 ACCEPTED SOLUTION

Accepted Solutions
pstork
Level: Powered On

Re: Leave Request Customization

1) I haven't tested it, but that code looks like it should work. 

2) The comments in the article about Patch are only if you wanted to update the leave type collection while the app is running.  There's no real need to do that.

3) The default values are stored in another collection that is created later in that same OnStart code where you found the LeaveType collection.  Its way down at the bottom.

4) The code for updating the balance will be spread in different places in the app.  I don't know if changing the default leave types will affect that or not.  It may work off the leave type that is selected.  But you should review all the code and make sure you understand what each piece does.  There may be other spots you'll need to adjust.

3 REPLIES 3
Super User
Super User

Re: Leave Request Customization

As the thread you mentioned says.  All these values are stored in collections that are created in the OnStart method of the App.  You can edit the OnStart method by selecting the App entry at the top of the tree view on the left side of the editor.  If you expand the formula bar for the OnStart method of the App you will see that it contains code to create several collections including the LeaveTypeCollection and the BalanceCollection.  These two collections hold the records that define the things you want to change.  If you change the values here and re-run the app you should see the new settings.

 

I'm not sure what you found unclear about the other thread. If you can be specific about your questions I will try to help.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
MeeraThakkar
Level: Powered On

Re: Leave Request Customization

Hello @Pstork1 ,

Thank you for your reply.

 

Below are my further doubts:

1) Can I update LeaveTypeCollection existing values like below?

 

 ClearCollect(
LeaveTypeCollection,
Table(
{
type:"Vacation",
icon:vacation,
iconselected:'vacation-selected',
description:
"Vacation leave is provided to all employees for the purpose of rest, relaxation, and to attend to personal affairs. Vacation balance is acquired over time and can be used at any time."
}
,....
)}

 to 

 

 ClearCollect(
    LeaveTypeCollection, 
        Table(
                {
                    type:"Paid Leave", 
                    icon:vacation,
                    iconselected:'vacation-selected',
                    description:
                    "All Employees get 12 paid leave per year. If unused can be encashed at the end of the year"
                }
                ,....
)}

2) As explained in the blog https://powerusers.microsoft.com/t5/General-Discussion/PowerApps-Template-Leave-Request/td-p/191780 , it has the patch functions to update the collection as well. How / where to use these functions?

 

3) After updating the leave types, we need to update its default values, i.e. current values of all employees. How to do that?

 

4) The code of updating the leave balance values when the employee applies the leave and manager approves it, needs to be updated as well. How to do that as well?

 

Thanks for your help,

 

Regards,

Meera.

 

pstork
Level: Powered On

Re: Leave Request Customization

1) I haven't tested it, but that code looks like it should work. 

2) The comments in the article about Patch are only if you wanted to update the leave type collection while the app is running.  There's no real need to do that.

3) The default values are stored in another collection that is created later in that same OnStart code where you found the LeaveType collection.  Its way down at the bottom.

4) The code for updating the balance will be spread in different places in the app.  I don't know if changing the default leave types will affect that or not.  It may work off the leave type that is selected.  But you should review all the code and make sure you understand what each piece does.  There may be other spots you'll need to adjust.

Helpful resources

Announcements
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

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 84 members 4,527 guests
Please welcome our newest community members: