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
Unanswered

Leave Request Template - Changing Data Source ***Help!

(0) ShareShare
ReportReport
Posted on by 72

Hello to all the community!

@v-bofeng-msft and @Moreshwar, thank you both since all your previous replies to different users have help me a lot.

Sorry to bother you but I need help.

 

I have follow this 2 guides:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Leave-Template-Include-half-day-option/td-p/787192

https://powerusers.microsoft.com/t5/Building-Power-Apps/Leave-Request-Changing-Data-Source/m-p/971626#M308834 

to add a Half Day option to our template and creating SharePoint list to use instead the OneDrive.

Changing the Data Source allows me to do everything as long as I don't make the app mine.

More or less working

zmm14_0-1625422482559.png

 

I tried to submit an approval to myself (to test the app before letting everyone now at my organization) but for some reason only stay in the screen, and never gets to my email.

zmm14_2-1625423349887.png

 

This is the OnStart formula that is working for SP datasource and Half Day option

 

Set(
_sendEmailsEnabled,
false
);
Concurrent(
//collection used in the left nav menu
ClearCollect(
EmployeeNavigation,
{MenuItem: "My Leave Requests"},
{MenuItem: "My Leave Balance"},
{MenuItem: "Company Holidays"},
{MenuItem: "About"},
{MenuItem: "Log out"}
),
//collection used in the left nav menu
ClearCollect(
ManagerNavigation,
{MenuItem: "Leave Requests"},
{MenuItem: "Company Holidays"},
{MenuItem: "About"},
{MenuItem: "Log out"}
),
//add custom leave types to this collection to make them show up in the app
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."
},
{
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."
},
{
type: "Rollover",
icon: 'rollover.png',
iconselected: 'rollover-selected.png',
description: "Rollover are vacation days from previous year. All Rollover must be taken before March 31 of current year. Rollover days can't be cashed."
},
{
type: "Half Day",
icon: 'half-day.png',
iconselected: 'half-day-selected.png',
description: "If You need a special permit you can request your manager a half day leave in the morning from 8:30 am to 12:30 pm or half day leave in the afternoon from 12:30 pm to 4:30 pm."
},
{
type: "Maternity Leave",
icon: 'maternity-leave.png',
iconselected: 'maternity-leave-selected.png',
description: "Female employees as per law have a total of 90 days of maternity leave and are to be taken 1.5 months before the delivery and 1.5 month after the delivery. For Male employes will be a total of 3 days."
}
)
),
//defines leave start and end for requests. Default set to Now since most users will be creating new requests. Changes to reflect leave times for requests which are being edited
Set(
_leaveStart,
Now()
),
Set(
_leaveEnd,
Now()
),
Set(
_myProfile,
Office365Users.MyProfile()
),
ClearCollect(
EmailTemplate,
"<html>

<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=us-ascii"">
</head>

<body>
<p>
There is a leave request from: {SubmitterName} pending your approval. <ul><li>Type: {LeaveType}</li><li>Title: {LeaveTitle}</li><li>Description: {LeaveDescript}</li><li>Start Date: {LeaveStart}</li><li>End Date: {LeaveEnd}</li>" & "</p>
</body>
</html>"
),
ClearCollect(
HolidaysCollection,
{
HolidayName: "Thanksgiving",
StartDate: DateValue("11/22/2018")
},
{
HolidayName: "Day after Thanksgiving",
StartDate: DateValue("11/23/2018")
},
{
HolidayName: "Christmas",
StartDate: DateValue("12/25/2018")
},
{
HolidayName: "DayAfterChristmas",
StartDate: DateValue("12/26/2018")
},
{
HolidayName: "New Year's Day",
StartDate: DateValue("1/1/2019")
}
)
);
ClearCollect(
BalanceCollection,
{
EmployeeEmail: _myProfile.UserPrincipalName,
EmployeeName: _myProfile.DisplayName,
Year: Text(Year(Now())),
Vacation: 22,
VacationUsed: 0,
Sick: 18,
SickUsed: 0,
Floating: 0,
FloatingUsed: 0,
JuryDuty: 5,
JuryDutyUsed: 0,
Bereavement: 90,
BereavementUsed: 0,
BalanceID: _myProfile.UserPrincipalName & Text(
Now(),
"[$-en-US]mm-dd-yyyy-hh-mm-ss-fff"
)
}
)

 

What am I missing or doing wrong?

Thanks again.

Categories:
I have the same question (0)
  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @zmm14 

     

    Download working Sample App including flow approval process  from Reza Dorrani- https://github.com/rdorrani/PowerApps.

     

     

     

  • zmm14 Profile Picture
    72 on at

    Thank You @Ramole for the suggestion. I dont know how to add a half day option to your suggestion.

    I would prefer use the template I try before

     

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard