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?
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