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

Request Leave - Requester/Sender

Hi There,

I'm creating Leave Request using POwerApps template and I managed to modify the details. only problem is, If I am the requester and sending a request  to my manager why I'm getting the emial request and my manager didn't receive any notifications from requester.

Could someone help me on this, please?

thank you

 

3 REPLIES 3
Community Support Team
Community Support Team

Re: Request Leave - Requester/Sender

Hi @hh01 ,

Could you please share a bit more about your scenario?

Do you mean that when you send a request to your manager within this template app, you get the email request, but your manager could not get?

 

Based on the issue that you mentioned, I have made a test on my side. In default, when you submitted a Leave Request within this template app, it would send an meail to the requester rather than his manager.

 

If you want to send the Leave Request to your manager rather than yourself, please consider take a try with the following workaround:

Within the "ConfirmationScreen" screen, please modify the formula within the OnVisible property as below:

If(_submittingRequest,
    Concurrent(
        Set(_navMenuSelect, ""), 
        //if editing a request, revise the record that is being edited, otherwise create a new one 
        Patch(LeaveCollection, If(_editingRequest, LookUp(LeaveCollection, LeaveID = GalleryRequests.Selected.LeaveID), Defaults(LeaveCollection)),
        {
            Title: TextInput1.Text,
            Detail: TextInput1_1.Text,
            StartDate: LeaveStartDatePicker.SelectedDate,
            EndDate: LeaveEndDatePicker.SelectedDate,
            LeaveType: _selectedLeaveType.type,
            Approver: _selectedApprover.UserPrincipalName,
            Status: "Pending",
            Requester: _myProfile.UserPrincipalName,
            LeaveID: If(_editingRequest, GalleryRequests.Selected.LeaveID, Text(Now(), DateTimeFormat.LongDateTime24) & _myProfile.UserPrincipalName)
        }
    ),
    //create email template data specific to the request
        ClearCollect(TemplateData,
            {Field: "{SubmitterName}", Data: _myProfile.DisplayName}, {Field: "{LeaveType}", Data: _selectedLeaveType.type}, {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")}
        )
    );
    //substitute template data values for placeholder
    ForAll(TemplateData, Patch(EmailTemplate, First(EmailTemplate), {Value: Substitute(First(EmailTemplate).Value, Field, Data)}));
    // Modify your formula below:
    Office365.SendEmail(_selectedApprover.UserPrincipalName, "New Leave Request", First(EmailTemplate).Value, {Importance: "Normal", IsHtml: true});              /* <-- modify your formula. Please type _selectedApprover.UserPrincipalName rather than _myProfile.UserPrincipalName */
    //reset all user nput fields
    Concurrent(
        Set(_submittingRequest, false),
        Set(_leaveStart, Today()),
        Set(_leaveEnd, Today()),
        Set(_leaveTitle, ""),
        Set(_leaveDetail, ""),
        Set(_selectedLeaveType, Blank()),
        Reset(TextInput1),
        Reset(TextInput1_1),
        //reset email template to placeholder values when finished (see phone version for an alternate method of doing this)
        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>"
        )
    )
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hh01
Level: Powered On

Re: Request Leave - Requester/Sender

Thanks, now the manager can receive email notification but he/she cannot see any request on their apps when logged as a manager.

 

thanks

Community Support Team
Community Support Team

Re: Request Leave - Requester/Sender

Hi @hh01 ,

I have made a test on my side, please consider take a try with the following workaround:

1. Go to "HomeScreen" in your app.

2. Modify the formula within the Items property of the "GalleryRequests" gallery as below:

//Filter values based on _requestTypeFilter, set by selecting item in GalleryFilters. Sort by StartDate, descending.
Sort(
    If(
_requestTypeFilter="All", Filter(LeaveCollection, If(_managerView, Approver = _selectedApprover.UserPrincipalName, Requester = _myProfile.UserPrincipalName)), /* <-- Modify formula here. PLease type _selectedApprover rather than _myProfile */ Filter(LeaveCollection, Status=_requestTypeFilter && If(_managerView, Approver = _selectedApprover.UserPrincipalName, Requester = _myProfile.UserPrincipalName)) ), /* <-- Modify formula here. PLease type _selectedApprover rather than _myProfile */
StartDate, Descending
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

Join us 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

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

Top Kudoed Authors
Users Online
Currently online: 399 members 2,880 guests
Please welcome our newest community members: