cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brammers
Advocate II
Advocate II

Custom Fields in the User Entity

Hi, i'm a bit new to CDS, so apologies in advance if this has been asked elsewhere, and I was unable to find it in the search!

 

Basically, I have a selection of custom entities which I use for various custom PowerApps that I have built. These are all working fine, no problems at all.

 

I am currently working on a 'Staff Details' type app, which I have linked to the default 'User' entity in CDS - again - all fine, all working as expected and data can be seen and edited (including a few custom fields I have added to the 'User' entity).

 

Now, what I am having trouble with is linking entities together via a common field / key - i.e - I have a 'Leave Data' entity that tracks staff leave / absences / entitlements, but I would also like to be able to see this data in the 'User' entity - but I don't want to enter it all again, I just want it to look up the values from the 'Leave Data' entity, and have it linked to the User record based on the Primary Email ID.

 

Any advice would be welcome. I've tried creating relationships, but there is no way of specifying a key to base the lookup on?

 

Thank you in advance.

1 REPLY 1
EricRegnier
Super User
Super User

Hi @Brammers,

The CDS way to relate entity together is with a lookup type field. When creating a lookup field, in your case, a lookup to User entity on "Leave Data", it creates a 1-N CDS relationship, where the foreign key (GUID) of user is saved on the Leave Data. If you're using model-driven apps you can easily have a subgrid on your form that displays all related leave records. If you're using canvas apps, you can also list the related entities, by filtering the gallery with select User ID (GUID). Have a look at this page for canvas apps: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-references

Hope this helps...

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,349)