Create a parent list
- Create a new Custom List named "ParentList"
- Create a new Coumn in that list as per the following settings:
2. Create a child list
- Create a new Custom List named "ChildList"
- Create a new Column in that list as per the following settings:
Please note that I checked the City checkbox. This will create a Projected Field against the lookup automatically so you can view that information which exist in the parent list - directly in the child list.
3. Test out the projected fields functionality
Add some new items in the ChildList to see that when you add an item and choose a company from the ParentList it will automatically show the projected field ("City") as a read-only field in the child-list:4. What about enforcing relational behavior?
I'm glad you asked. When you create (or change settings for) a lookup field (like the "ParentLink" field), you have the ability to change settings for the relational behavior.Go to your "ParentLink" column, or when you create a new lookup field - and see the following dialog:
From this dialog as you can see, you have the ability to make the necessary settings for your fields.
Restricted Delete
If you choose the "Restricted Delete" option, you will see the following behavior when trying to delete an item that has related items:Cascade Delete
If you choose the "Cascade Delete" option for your lookup field instead, you'll be sending the items directly to the Recycle Bin instead. Then it'll look like this in the recycle bin:Note, that you have the icon that looks like a relational diagram in your recycle bin - this means that you've deleted an item that may have deleted linked items. If you restore this item (in our case, TOZIT) it will automatically restore all of the items that were originally deleted.
So, we have the kind of enforced relationships we've longed for since the dawn of days!
Summary
Voila. Easy as 1-2-3, you have created two very simple lists and created a relationship between them - and optionally you can enforce this relationship using the "Enforce relationship behavior" settings for Restrict Delete or Cascade Delete.Enjoy!