web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Leave Request Template...
Power Apps
Answered

Leave Request Template - Edit types of Leave

(1) ShareShare
ReportReport
Posted on by 92

Hello all,

 

We are in the process to deply the PowerApps template of Leave requests within our org.

Can you please assist me on how to remove completely from the template some leave types?

 

From the OnStart i've left only the below

 

 

LeaveTypeCollection, 
 Table(
 {
 type:"Vacation Leave", 
 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."
 }
 ,
 {
 type:"Sick Leave", 
 icon:'sick-leave', 
 iconselected:'sick-leave-selected',
 description:"Sick leave may be used for your own illness or medical/dental appointments or for the illness or medical/dental appointments of family members. Sick leave can also be used to address the psychological, physical, or legal aspects of domestic violence, sexual assault, stalking, or other crime. You may not use sick leave for vacation purposes. Some cities and states have specific laws governing sick leave that allow use of sick leave to care for other family members."
 }

 

 

 

On 'About' section and on New request i can see only these two types,

BUT, on 'My Leave Balance' all types are visible.

Categories:
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at

    Did you Save and Publish your app? Or within your editor did you click on the 3 dots next to the App and select Run OnStart? 

     

    Also, if not for anything else but to keep it clean, I would remove those leave types from this collection as well: 

    ClearCollect(BalanceCollection,
     {
     EmployeeEmail: _myProfile.UserPrincipalName, 
     EmployeeName: _myProfile.DisplayName , 
     Year: Text(Year(Now())), 
     Vacation:10, 
     VacationUsed:0, 
     Sick:8, 
     SickUsed:0, 
     Floating:8, 
     FloatingUsed:0, 
     JuryDuty:3, 
     JuryDutyUsed:0, 
     Bereavement:5, 
     BereavementUsed:0, 
     BalanceID:_myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")
     }
    )

     

    Let me know if these changes work out for you. 

     

    ---
    If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

     

    Thanks!

    Hardit Bhatia

    Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

  • dB4 Profile Picture
    92 on at

    Hello @PowerAddict  and thanks for your reply.

    I have already removed your suggested and left only the below

     

     LookUp(Balance, Year = Text(Year(Now())) && EmployeeEmail = _myProfile.UserPrincipalName)),
     Patch(Balance, Defaults(Balance),
     {
     EmployeeEmail: _myProfile.UserPrincipalName, 
     EmployeeName: _myProfile.DisplayName, 
     Year: Text(Year(Now())), 
     Vacation:15, 
     VacationUsed:0, 
     Sick:8, 
     SickUsed:0, 
     BalanceID:_myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")
     }
     )
     ),

     

    But on 'My leave balance' section, all template's default types of leaves are visible.

     

    powerapps1.PNG
    powerapps2.PNG
  • Verified answer
    PowerAddict Profile Picture
    7,316 Most Valuable Professional on at

    My bad, here are the additional changes you need to make:

    1. HomeScreen -> OnVisible

    Concurrent(
     Set(_navMenuSelect, "My Leave Requests"),
     //if not manager view, refresh my balance collection when on this screen
     If(!_managerView, Set(_requesterBalanceRecord, LookUp(BalanceCollection, Year = Text(Year(Now())) && EmployeeEmail = _myProfile.UserPrincipalName));
     ClearCollect(RequesterBalanceCollection, 
     { type: "Vacation", balance: Value(_requesterBalanceRecord.Vacation) - Value(_requesterBalanceRecord.VacationUsed)},
     {type:"Sick Leave", balance:Value(_requesterBalanceRecord.Sick)-Value(_requesterBalanceRecord.SickUsed)}/*,
     {type:"Floating Holiday", balance:Value(_requesterBalanceRecord.Floating)-Value(_requesterBalanceRecord.FloatingUsed)},
     {type:"Jury Duty", balance:Value(_requesterBalanceRecord.JuryDuty)-Value(_requesterBalanceRecord.JuryDutyUsed)},
     {type:"Bereavement", balance:Value(_requesterBalanceRecord.Bereavement)-Value(_requesterBalanceRecord.BereavementUsed)}*/)
     ),
     Set(_showDetails, false)
    );

     

    2. HomeScreen -> BtnManagerApprove

    Concurrent(
     Set(_submittingRequest, true),
     //when approving leave, add the respective days used to the respective used days field
     Patch(BalanceCollection, LookUp(BalanceCollection, BalanceID = _requesterBalanceRecord.BalanceID),
     If(Upper(GalleryRequests.Selected.LeaveType) = Upper("Vacation"), {VacationUsed: _requesterBalanceRecord.VacationUsed + _requestedDays},
     Upper(GalleryRequests.Selected.LeaveType) = Upper("Sick leave"), {SickUsed: _requesterBalanceRecord.SickUsed + _requestedDays}/*,
     Upper(GalleryRequests.Selected.LeaveType) = Upper("Floating holiday"), {FloatingUsed: _requesterBalanceRecord.FloatingUsed + _requestedDays},
     Upper(GalleryRequests.Selected.LeaveType) = Upper("Jury duty"), {JuryDutyUsed: _requesterBalanceRecord.JuryDutyUsed + _requestedDays},
     Upper(GalleryRequests.Selected.LeaveType) = Upper("Bereavement"), {BereavementUsed: _requesterBalanceRecord.BereavementUsed + _requestedDays}*/
     )
     ),
     Set(_managerApprove, true));
    Patch(LeaveCollection, LookUp(LeaveCollection, LeaveID = GalleryRequests.Selected.LeaveID), {Status: "Approved"});
    Set(_submittingRequest, false);
    Navigate(ManagerChangeRequestScreen, None);
     

     

    3. LeaveBalanceScreen -> OnVisible

    Concurrent(
     Set(_navMenuSelect, "My Leave Balance"),
     ClearCollect(RequesterBalanceCollection, 
     { type: "Vacation", balance: Value(_requesterBalanceRecord.Vacation) - Value(_requesterBalanceRecord.VacationUsed)},
     {type:"Sick Leave", balance:Value(_requesterBalanceRecord.Sick)-Value(_requesterBalanceRecord.SickUsed)}/*,
     {type:"Floating Holiday", balance:Value(_requesterBalanceRecord.Floating)-Value(_requesterBalanceRecord.FloatingUsed)},
     {type:"Jury Duty", balance:Value(_requesterBalanceRecord.JuryDuty)-Value(_requesterBalanceRecord.JuryDutyUsed)},
     {type:"Bereavement", balance:Value(_requesterBalanceRecord.Bereavement)-Value(_requesterBalanceRecord.BereavementUsed)}*/
     )
    )

     

    4. ManagerChangeRequestScreen -> OnVisible

    Concurrent(
     Set(_navMenuSelect, "My Leave Balance"),
     ClearCollect(RequesterBalanceCollection, 
     { type: "Vacation", balance: Value(_requesterBalanceRecord.Vacation) - Value(_requesterBalanceRecord.VacationUsed)},
     {type:"Sick Leave", balance:Value(_requesterBalanceRecord.Sick)-Value(_requesterBalanceRecord.SickUsed)}/*,
     {type:"Floating Holiday", balance:Value(_requesterBalanceRecord.Floating)-Value(_requesterBalanceRecord.FloatingUsed)},
     {type:"Jury Duty", balance:Value(_requesterBalanceRecord.JuryDuty)-Value(_requesterBalanceRecord.JuryDutyUsed)},
     {type:"Bereavement", balance:Value(_requesterBalanceRecord.Bereavement)-Value(_requesterBalanceRecord.BereavementUsed)}*/
     )
    )

     

    5. ManagerSendEmailScreen -> OnVisible

    Concurrent(
     Set(_navMenuSelect, "My Leave Balance"),
     ClearCollect(RequesterBalanceCollection, 
     { type: "Vacation", balance: Value(_requesterBalanceRecord.Vacation) - Value(_requesterBalanceRecord.VacationUsed)},
     {type:"Sick Leave", balance:Value(_requesterBalanceRecord.Sick)-Value(_requesterBalanceRecord.SickUsed)}/*,
     {type:"Floating Holiday", balance:Value(_requesterBalanceRecord.Floating)-Value(_requesterBalanceRecord.FloatingUsed)},
     {type:"Jury Duty", balance:Value(_requesterBalanceRecord.JuryDuty)-Value(_requesterBalanceRecord.JuryDutyUsed)},
     {type:"Bereavement", balance:Value(_requesterBalanceRecord.Bereavement)-Value(_requesterBalanceRecord.BereavementUsed)}*/
     )
    )

     

    I tested this out so it should work. But let me know if it doesn't. 

     

    ---
    If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

     

    Thanks!

    Hardit Bhatia

    Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

     

     

  • dB4 Profile Picture
    92 on at

    Dear @PowerAddict good day.

     

    Many thanks for your inputs, it has solved my issue with the extra types of leave.

    I assume that the same procedure, backwards, should be followed in order to add new types of leave.

     

    Another Q: On the excel created in the powerapps backbone, with all the information, how can I add Org's rest of employees?
    Just by adding their e-mail and balance?

  • dB4 Profile Picture
    92 on at

    @PowerAddict,

     

    I have accidentaly deleted the 'Manager' section, meaning that there's only Employee Login, and once a request is submitted, manager only receives the notification e-mail.

     

    Ok, so i copied the button and its function from the default template, and im facing 2 issues now.

    When i login as a Manager, i'm getting the above error, and the submitted requests are not visible for review.

     

    Office365Users.UserPhotoMetadata failed: The method 'UserPhotoMetadata' has an invalid value for parameter 'userId'

     

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at

    Glad I could help!

     

    1.

    Q: I am not sure I understand your 1st question: "Another Q: On the excel created in the powerapps backbone, with all the information, how can I add Org's rest of employees? Just by adding their e-mail and balance?"

    A: I don't think there is an excel that stores the data. There are 2 connectors that the app uses - Office365 and Office365Users. 

     

    2. 

    Q: When i login as a Manager, i'm getting the above error, and the submitted requests are not visible for review.

    A: Did you include this in your OnVisible property of LoginScreen?

    Set(_selectedApprover, Office365Users.Manager(_myProfile.Id));

     

    Let me know if this helps. If not, it might be easier to start again from the template and make the changes I suggested originally to remove the leave types you don't want. 

     

    ---
    If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

     

    Thanks!

    Hardit Bhatia

    Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

     

  • dB4 Profile Picture
    92 on at

    Hello @PowerAddict 

     

    Yes, this was already included in the OnVisible field.

     

    Regarding the Excel, indeed there is a file with all the App stored information

    OneDrive - *****\PowerApps\Templates\LeaveRequest_b37411a99d4

     

  • Dovetail Profile Picture
    66 on at

    Hi There, May i ask how you were able to change the Leave Balance, i am struggling

  • dB4 Profile Picture
    92 on at

    Hello there mate,

    Which leave balance you wanna edit? the naming or the values?

    The values can be edited through the Excel in OD.

  • Chulani Profile Picture
    2 on at

    Hi All, 

     

    Couple of questions if you could help me out here

     

    1. I have tried editing the leave balance on the App OnStart but still the default values are being displayed? Any idea why this is happening?
    2. How does the leaves get updated for the other users? I have been able  to access the excel in OneDrive and updated the leave balances for a user but it does not reflect in the powerapp. 

     

    I have been breaking my head on this but to no avail. I'd be grateful for any help.   

     

    Thank You.

    Chulani

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard