cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
miguelits
Regular Visitor

Leave request template

Hi everyone, first of all, sorry for my English, if it can called that. I'm newcomer ussing powerapps and I trying to implement this app to be used by my department. If you don't notice yet, I'm Spanish and must translate the entire app. Once this is done I have encountered two issues, firstly the data source don't store the new leave request, I've tried to reconnect data source but doesn't work, not update the data that I was introduced in the app like as holiday collection or balance. I would like to store the data source in SP list, but I don't know how to do it.

 

Secondly I need to approval in two steps, first by line manager, user must not be notified and status not changed, second by manager when the user must be notified.

 

Thanks in advance 

 

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @miguelits ,

Do you make this template app as your own app (click "Make my own app" button)?

 

For your first question, have you made this template app as your own app? Do you want to save your new Leave Request into the LeaveCollection?

On your side, you should make this template app as your own app firstly via clicking "Make my own app" button. Actually, when you submit a new leave request, the new submitted request would be saved into the LeaveCollection collection (same as BalanceCollection and HolidayCollection). The LeaveCollection collection (same as BalanceCollection and HolidayCollection) is initialized within the OnStart property of the App control as below:3.JPG

If you want to save the new submitted leave request into your SP list, you must add same columns as that in the LeaveCollection within your SP list. The data structure should be as below:4.JPG

then add your SP list as a data source within your app instead of LeaveCollection collection. If you want to save your new leave request into your SP list, please modify the formula within the OnVisible property of the ConfirmationScreen to following:

 

If(_submittingRequest,
    Concurrent(
        Set(_navMenuSelect, ""), 
        //if editing a request, revise the record that is being edited, otherwise create a new one 
        Patch("YourSPList", If(_editingRequest, LookUp("YourSPList", LeaveID = GalleryRequests.Selected.LeaveID), Defaults("YourSPList")),  /* <-- Please replace LeaveCollection with your SP List data source here */
        {
            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
...
...
...

 

 

For your second question, do you want the request the user made to be approved by two managers? Based on the needs that, I think you need to custom your app.

I think you need to add another column (Approver2) within your SP list to store the second Approver email. Then when the second approver approve the request, the user would be notified.

 

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.

I will answer your questions

I made my own app, but the new request did't store anything at LeaveCollection collection and neither in Leave data source sheet on excel file stored in OneDrive for Business. I think that it should be the correct way, ins't true?

I make the change that you suggest, I created a SP list, add as a data source and modify the ConfirmationScreen, now the problem is that nothing is shows at HomeScreen and shows a warning 

 

warning.PNG

 

The warning says something like problably the result of formula Filter does not work correctly with bi data source. Maybe the data source can't process the formula and result of data set is incomplete.

 

It's looks like I must make more change along the app 

 

In my second question I think that add one column with approver2 is not enought to make approval in two steps. I need to get that when the first approver approves the request, notify the second approver that they have a pending request and this approves the request and notifies the user

Can you help me to going in the correct way?

 

 

Hi @v-xida-msft 

 

I test your solutions but I have new issues that I don't know to solve

I created a SP list to save and store the new requests but I don't know what I have to do to show the new record at HomeScreen.

How do I replace the collection LeaveCollection in OnStart App if I wasn't use it without new crashes in the entire app.

I'm not a developer, maybe that's hard for me to undertand the app and powerapps in general. I'm just system administrator with curiosity.

 

Thanks in advance

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,885)