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

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,707)