Creating a Parent-Child list Relationship
In this walkthrough, we will define the steps to create a Parent-Child Relationship with two lists. For the purpose of this document we will discuss this in generic terms, since we have already shown the different content types and usage scenarios in previous documents.
Parent-Child relationship schema
The idea of a parent-child relationship to have two lists that are connected in a 1 to Many database design schema. This setup is very helpful when there is a need to have one record that hold some basic common information (for example; an Order form) and then link that to a list of items that are related to that record. (for example; the ordered items). There are many other examples like and project-task, etc…
When setting up this schema, we need to define the basic components first to be able to setup the relationship. So, to do that we need to;
- Define the Child list, this will be the list that holds the many records that will relate to one parent record.
- Define the Parent list, this being the parent record that the child records point back to
- Define the Associated Item Column that allows for the creation of the child records from within the parent forms.
Defining the Associated Child list
When defining an associate child list there are 2 different ways to define them depending on your application use case.
Entering your child records outside of your parent.
Possible use cases:
- Exporting your task records to thrid party tools
- Actions that create sets of items/tasks by default
- call-in/incident logs to be related to customer records
- ... etc
When your users update the child lists independently from the Parent record. For instance, your team members would create the task or item records and then manually assign those to the parent project or order record. Then you want to setup your child list as a normal custom list that as a lookup field that lookups the parent record title or ID. This child list can still be setup as an Associate Item field on your Parent List.
Using the Parent record to enter your Child records
Possible use cases:
- Invoice and Expense reporting systems
- Project/task mangement
- Event/task management
- … etc
When your user to enter the child records by editing your parent form. For example, a project manager assigning tasks to his team members for a project. Then you will need to setup the Child List using the one of the 3 Infowise Associated Content Types (Item, Task, Document). This way your user does not have manually select the Parent record cause the Associated Content Type will do this automatically.
There is more information about the Usage Scenarios documentation.
For our purposes, we’ll simply create a custom list and add the Associate Item Content type which covers 3 of those types to it and remove the default Item content type. We do this by
- Going to Site Contents and clicking Add an App > Custom list
- Now go to list settings > Click on Advanced settings > Enable content type management and save
- Under Content type, click to add an existing content type
- Select Infowise under groups and then double-click Infowise Associated Item content type
- Save and return to list settings
- Click on Item content type and delete it from the list.
- Your list should now contain only Associated Task content type and be set as default.
Note: The reason for using the Infowise Associate Content Types is that there are built-in fields that work to maintain the parent-child relationship from the child records. They work much the same as a lookup to the parent record would work in a more integrated way.
Defining the Parent list
The next list to create is the parent list, although it does not matter which list gets created first. The creation of this list is pretty much the same as the Child list except, you do not need to add the Special Infowise content types to this one. The default content type will work just fine.
Defining the Associated Item Column on the Parent lists
Now from the Parent List (must not be the child associate list) where you want to define this parent-child relationship…
- Go to the Infowise design Icon or List Settings.
- Choose to add an Associated Items Column.
- Select the Associated Items List you just created in the appropriate field.
- All the other settings should be filled out automatically.
The following details are about the fields to configure the Associate Item Column on the parent.
- Child Site – select the site where your related list is located. This can be the current site or any other site of the site collection.
- Child list – list or document library storing the related items.
- Child Content type – if more than one content type exists in the list, select the appropriate one, otherwise no changes are required or possible.
- Child view – specifies the view of the child items list to display in the field. Using this setting you can define which fields will appear and in what order.
- Show view selector – allow users to dynamically switch views from the associate item field itself.
- Items per page –turn paging on and off and specify number of items per page.
- Details Label – the text to display for the link that will show the child records in the parent list view. Default is “Click of details”.
- Allow adding items – to display the child item generation controls on the item’s Edit form.
- Allow adding when parent item in Display mode - allow adding new related items even when the parent item is in Display form.
- New Item Label – the text to display for adding new child items. Default is “New Items”.
- Generate tasks automatically – (applies to On-Premise Associate Task only) enables automatic generation of tasks, based on content type, users/groups entered in the referred column and predefined task title and due date. This option is not available in the app version.
- Source column – (applies to On-Premise Associate Task only) column in the current list to pull the users/groups for task auto-generation.?This option is not available in the app version.
- Allow editing title – (applies to On-Premise Associate Task only) you can allow users enter their own task title or enter a preselected title for all tasks. In some cases, when you need to assign the same tasks to all users (e.g. Please review this document), it is easier not to enter the same title every time. You cannot enable title editing when using auto-generation. This option is not available in the app version.
- Default days to due date – (applies to On-Premise Associate Task only) default number of days between today and the default task due date. This option is not available in the app version.
- Enable due date editing – (applies to On-Premise Associate Task only) enable users modify due date. You cannot enable this option when using task auto-generation. This option is not available in the app version.
- Task managers – (applies to On-Premise Associate Task only) by default clicking on the item title opens the child item in display mode. From there the item can be edited or deleted.
- Target Folder Path - (applies to On-Premise Associate Document only) you can set this to define what folders these child documents will be saved too.
- Actions – (applies to On-Premise only) you can set up custom actions to be performed by users on all related items, such as delete or update. For more details refer to Actions section of this documentation. This option is not available in the O365 app version.
Adding New Child Records to a parent record
Once you have created the column you can add it to your forms. The Associate Item column will display with the features that you configure it with. Specifically, with a “+ New Item”, or something you had defined based on the options in the above configuration items. You can add new child items while adding or editing the parent item.
Consider the following scenario – you are managing events in your calendar and you need to assign child tasks/items for several employees to prepare the event. You will need to create an Infowise Associated Items column as described above. Afterwards, while entering each new event you can add all the accompanying tasks without leaving the context of the event.
NOTE: In the app version, you add tasks using a pop-up New form, the same as the regular New form of the task list. Simply click on New Entry link under the column.
How the Associated Items works
Each child item links back to the parent item using a special internal fields to facilitate the relationship. The field value is managed automatically by the system. For the link to function correctly, it needs to contain the ID of the parent item. This ID is assigned only after the parent item has been created, thus when entering the tasks during the parent item’s initial entry stage will not fill out the parent link. When viewing/modifying the parent item for the first time after the initial entry, the system will fill out the missing parent links automatically, so if your business process requires parent link functionality, which is not a required by default, you need to add the associated child item during the Edit stage of the parent item or open the display view of the item after the initial entry to make sure the links are generated on the child items.
Here's a view of the IWParentLink on a child list view.