cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

CDS Canvas App- Gallery Loads Slowly when Filtered by Current User

My canvas app takes a long time, sometimes as much as a minute to load a gallery connected to CDS when it is filtered by the current user. 

 

I want it to display a list of open opportunities where the owner is filtered by the current user. Essentially the My Open Opportunities view. I know I can do this using experimental functionality by selecting the view but I need to use this in production.

 

The gallery is made up of the following collection created on the screen IsVisible property - 

ClearCollect(
    openOpportunities,
    Filter(
        Opportunities,
        Status = 'Status (Opportunities)'.Open
    )
);

This contains approximately 160 records.

 

The items property of my gallery is defined as - 

SortByColumns(
    Filter(
        openOpportunities,
        AsType(
            Owner,
            Users
        ).'Full Name' = CurrentUser.FullName
    ),
    "name"
)

The gallery eventually displays items when the app is launched but it takes a long time.

 

Is there a better way of doing this so as to speed things up?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: CDS Canvas App- Gallery Loads Slowly when Filtered by Current User

Hi @PaddyFreefall ,

 

To avoid delegation issues and at the same time to avoid creating a collection and then filtering,

 

On load of app, store User().FullName in a variable and use this variable to get the User entity value for logged in user

 

Set(userfullname,User().FullName);Set(currentuserOwner,LookUp(Users,'Full Name' = userfullname))

 

Next create your gallery and set items property as follows


Filter(
Opportunities,
Owner = currentuserOwner && Status = 'Status (Opportunities)'.Open
)

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User
Dual Super User

Re: CDS Canvas App- Gallery Loads Slowly when Filtered by Current User

Hi @PaddyFreefall ,

 

To avoid delegation issues and at the same time to avoid creating a collection and then filtering,

 

On load of app, store User().FullName in a variable and use this variable to get the User entity value for logged in user

 

Set(userfullname,User().FullName);Set(currentuserOwner,LookUp(Users,'Full Name' = userfullname))

 

Next create your gallery and set items property as follows


Filter(
Opportunities,
Owner = currentuserOwner && Status = 'Status (Opportunities)'.Open
)

 

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Highlighted
Advocate I
Advocate I

Re: CDS Canvas App- Gallery Loads Slowly when Filtered by Current User

Magic!

 

Thanks for your time and assistance @RezaDorrani . This worked a treat!

Highlighted
Dual Super User
Dual Super User

Re: CDS Canvas App- Gallery Loads Slowly when Filtered by Current User

@PaddyFreefall your most welcome

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,723)