cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dk4
Helper I
Helper I

Leave Management App - Sharepoint List Data Sources

Hi all,

 

I'm experimenting with the Request Leave Template app on powerapps, however I've recreated the collections in the app to a sharepoint list,

 

That done I have an issue with some functions used in the app, I can't recreate the same for a sharepoint list, specifically this:

 

Home screen: On Visible:

Concurrent(
    Set(
        _navMenuSelect,
        "My Leave Requests"
    ),
    //if not manager view, refresh my balance collection when on this screen
    If(
        !_managerView,
        Set(
            _requesterBalanceRecord,
            LookUp(
                'Leave Balance',
                Year = Text(Year(Now())) && Email = _myProfile.UserPrincipalName
            )
        );
        ClearCollect(
             RequesterBalanceCollection,
            {
                Title: "Vacation",
                balance: "Vacation" - "Vacation Used"
            },
            {
                Title: "Sick Leave",
                balance: "Sick Leave" - "Sick Leave Used"
            },
            {
                Title: "Floating",
                balance: Value(_requesterBalanceRecord.Floating)  - "Floating Used"
            },
            
            {
                Title: "Bereavement",
                balance: Value(_requesterBalanceRecord.Bereavement) - Value(_requesterBalanceRecord.'Bereavement used')
            }
        
        )
    ),
    Set(
        _showDetails,
        false
    )
);

How do I modify the clearcollect segment, to update the SharePoint list, it has the same type of columns as the collection,

 

Any help will be highly appreciated.

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @Dk4 ,

What do you mean about " modify the clearcollect segment, to update the SharePoint list"?

  • Do you want to use the RequesterBalanceCollection to update the SharePoint List?
  • What is the SharePoint list’s data structure(column name and column type)?

Could you please provide more information about your requirement?(Some screenshots better).

I assume you want to use the RequesterBalanceCollection to update the SharePoint List, so I do a simple test on my side for reference:

1. Create a new list called “LeaveRequest2” to keep the leave requests.

2. Go to NewRequestScreen and set OnSelect property of "Submit request" button to(just add a Patch() function):

Patch(LeaveRequest2,Defaults(LeaveRequest2),{Title:NRLeaveTypeLabel.Text,balance:LookUp(RequesterBalanceCollection,type=NRLeaveTypeLabel.Text).balance,Requester:User().FullName});

v-albai-msft_0-1613633531953.png

See results below. When some user submit a sick leave, his request information will update into the SP. Note: the balance value is the value before approving. You can also edit your formula to display new balance in your list.

v-albai-msft_1-1613633531960.png

v-albai-msft_2-1613633531962.png

Best Regards,

Allen

View solution in original post

1 REPLY 1
v-albai-msft
Community Support
Community Support

Hi @Dk4 ,

What do you mean about " modify the clearcollect segment, to update the SharePoint list"?

  • Do you want to use the RequesterBalanceCollection to update the SharePoint List?
  • What is the SharePoint list’s data structure(column name and column type)?

Could you please provide more information about your requirement?(Some screenshots better).

I assume you want to use the RequesterBalanceCollection to update the SharePoint List, so I do a simple test on my side for reference:

1. Create a new list called “LeaveRequest2” to keep the leave requests.

2. Go to NewRequestScreen and set OnSelect property of "Submit request" button to(just add a Patch() function):

Patch(LeaveRequest2,Defaults(LeaveRequest2),{Title:NRLeaveTypeLabel.Text,balance:LookUp(RequesterBalanceCollection,type=NRLeaveTypeLabel.Text).balance,Requester:User().FullName});

v-albai-msft_0-1613633531953.png

See results below. When some user submit a sick leave, his request information will update into the SP. Note: the balance value is the value before approving. You can also edit your formula to display new balance in your list.

v-albai-msft_1-1613633531960.png

v-albai-msft_2-1613633531962.png

Best Regards,

Allen

Helpful resources

Announcements
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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,517)