cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
panterra
Level 8

CDS Current User Filter

Hi, 

 

This might be an easy one for the CDS 2.0 Experts out there. I was wondering what the best way of filtering a CDS Entity to find records created by the current user. 

 

I would rather not query against an Email Address or Display Name as these can change for users over time. 

 

Also - In CDS 1.0, the Created By field stored the OID value of the user. It would be great to be able to continue to be able to query against this. 

 

Thank you,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: CDS Current User Filter

Hi @panterra,

Do you want to filter your CDS records created by current login user?

Actually, the 'Created By' column (System column) is a LookUp column in each Entity, which looks up to User Entity within your Common Data Service. In addition, the 'Created By' column link the corresponding user in the User Entity through a unique GUID string, e.g. '0342f767-4414-e911-a981-000d3a828979'.

If you just want to filter your CDS records based on the unqiue GUID string (OID value that you mentioned) of the current user, I afraid that there is no way to achieve your needs.

Currently, within PowerApps, there is no direct way to get the unique GUID String value of the current sign in user within the User Entity. You could only get the unique GUID string value via the Email Address, Full Name or ... of a user within the User Entity.

As an alternative solution, you could consider take a try to filter your CDS Entity records based on the email address of current login in user. I have made a test on my side, please take a try with the following workaround:9.JPG

Set the Items property of the Gallery to following:

Filter(TaskLists, 'Created By'.'Primary Email' = User().Email)

On your side, you should type:

Filter(YourCDSEntity, 'Created By'.'Primary Email' = User().Email)

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.
4 REPLIES 4
Community Support Team
Community Support Team

Re: CDS Current User Filter

Hi @panterra,

Do you want to filter your CDS records created by current login user?

Actually, the 'Created By' column (System column) is a LookUp column in each Entity, which looks up to User Entity within your Common Data Service. In addition, the 'Created By' column link the corresponding user in the User Entity through a unique GUID string, e.g. '0342f767-4414-e911-a981-000d3a828979'.

If you just want to filter your CDS records based on the unqiue GUID string (OID value that you mentioned) of the current user, I afraid that there is no way to achieve your needs.

Currently, within PowerApps, there is no direct way to get the unique GUID String value of the current sign in user within the User Entity. You could only get the unique GUID string value via the Email Address, Full Name or ... of a user within the User Entity.

As an alternative solution, you could consider take a try to filter your CDS Entity records based on the email address of current login in user. I have made a test on my side, please take a try with the following workaround:9.JPG

Set the Items property of the Gallery to following:

Filter(TaskLists, 'Created By'.'Primary Email' = User().Email)

On your side, you should type:

Filter(YourCDSEntity, 'Created By'.'Primary Email' = User().Email)

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.
panterra
Level 8

Re: CDS Current User Filter

Thank you for these details and other options. Just to confirm in CDS 1.0 was the value in the Created By User column the OID?  

juresti
Level 8

Re: CDS Current User Filter

Great, this is exactly what I was looking for as well.

We have an app where users will only load their own records on the edit screen.

CubixVision
Level: Powered On

Re: CDS Current User Filter

Hi, 

 

I am having the same issue and trying to follow the instructions.  The part of the solution I have a question about is when you say "On your side, you should type:", I am not too clear on what that statement means. 

 

Thanks in advance.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 176 members 5,380 guests
Please welcome our newest community members: