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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Editing leave template...
Power Apps
Answered

Editing leave template on Power Apps

(0) ShareShare
ReportReport
Posted on by 7

Hi, 

 

I am currently using the leave template app from Power Apps. I would like to edit the email template that is sent to the approver when an employee submits a leave request. Specifically, I'd like to add the current leave balance of the employee for the leave type that he is taking, as well as the leave balance after the approval (See below in blue)

 

The email example that approver will receive:

 

There is a leave request from: <Requester Name> pending your approval.

 

  • Type: Annual
  • Title: Leave Request
  • Description: Example Leave Request
  • Start Date: 12 July 2021
  • End Date: 12 July 2021
  • Requested Days: 1 
  • Current Leave Balance: 14
  • New Leave Balance: 13

 

Thank you!

 

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Fisrts step is to amend the mail template that is defined in a collection that is initiated in the app OnStart property:

     

    BCBuizer_0-1626092011162.png

     

    If you amend that, you can include your personal preferences. Without testing, this is what I think it should look like:

     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><li>Requested Days: {RequestedDays}</li><li>Current Leave Balance: {CurrentLeaveBalance}</li><li>New Leave Balance: {NewLeaveBalance}</li>" &
     "</p>
     </body>
     </html>"
     )

     

    Then you need to modify the mechanism that populates the mail template to include the new fields. This can be found in the OnVisible property of the ConfirmationScreen:

     

    BCBuizer_1-1626093413226.png

     

    If you replace the code between the two comments with the below, it should work:

     

     //create email template data specific to the request
     ClearCollect(
     TemplateData,
     {
     Field: "{SubmitterName}",
     Data: _myProfile.DisplayName
     },
     {
     Field: "{LeaveType}",
     Data: _selectedLeaveType
     },
     {
     Field: "{LeaveTitle}",
     Data: TextInput1.Text
     },
     {
     Field: "{LeaveDescript}",
     Data: TextInput1_1.Text
     },
     {
     Field: "{LeaveStart}",
     Data: Text(
     LeaveStartDatePicker.SelectedDate,
     "[$-en-US]mmm. dd, yyyy"
     )
     },
     {
     Field: "{LeaveEnd}",
     Data: Text(
     LeaveEndDatePicker.SelectedDate,
     "[$-en-US]mmm. dd, yyyy"
     )
     },
     {
     Field: "{RequestedDays}",
     Data: _RequestedDays
     },
     {
     Field: "{CurrentLeaveBalance}",
     Data: Label1_12.Text
     },
     {
     Field: "{FutureLeaveBalance}",
     Data: Label1_9.Text
     }
     )
     );
     //substitute template data values for placeholder

     

  • vapor Profile Picture
    7 on at

    Sorry I'm new to Power Apps. How do I pull out the leave balance for the logged in user when populating the mail template? Thank you.

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    In this scenario there's already formulas that populate two labels in the NewRequestScreen. With the below part of the earlier mentioned code, the values from those labels are pulled and inserted into the mail template:

     

     {
     Field: "{CurrentLeaveBalance}",
     Data: Label1_12.Text
     },
     {
     Field: "{FutureLeaveBalance}",
     Data: Label1_9.Text
     }

      

  • vapor Profile Picture
    7 on at

    Got it! Thank you! 

  • Universal_Power Profile Picture
    67 on at

    Hey there, I went through this post and wanted to know if it's possible to add a link back to the leave app in the email? I tried using this method but I'm not sure how to add this using the power app code, I attempted to add it on the app on start using HTML but it made the link a comment. 

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @Universal_Power ,

     

    Can you please open a new topic for this which includes the details of what you have been trying already? Like that it will be easier for other members of the community to find answers to similar questions and the question in itself is easier to answer.

     

    Please feel free to tag me for a guaranteed response in case nobody else replies before me.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard