Skip to content
Enkel Media edited this page Mar 28, 2017 · 3 revisions

All pickers (with the exception of Enums, as hard-coding Umbraco Ids to an Enum probably isn't a good idea) can be mapped to a Relation Type. In order to successfully create a relation, the picked keys must be able to be converted into integers representing Umbraco Ids of the correct Object Type as specified by the Relation Type. (Save Format is a separate configuration property, but shown here to illustrate a change when selecting a Bidirectional Relation Type later)

By default, relations will be created in a reverse direction (where the current Content / Media or Member being edited) will be the childId and the picked key will be the parentId. This is useful as the current Content / Media or Member can already easily query it's picked keys, whilst the reverse nature of the relation mapping allows the lookup from a picked item to see where it has been picked.

For example, Relation Mapping can be used in conjunction with Relation Labels on the picked items such that they can then render details about where they have been picked.

When a Bidirectional Relation Type is selected, a new Save Format option becomes available.

If the Save Format is set to Relations Only, this ensures no local value is stored on the item being edited, causing the picked keys to be loaded from the relations data - this enables pickers to be 'wired-up' such that changing a picker on one end will cause any corresponding pickers to 'update'. Note that this currently only works if you are using the same picker (data type) on both sides as each relation are stored with a reference to the data type definition.

For example using a picker to pick related products, and product 1 picks product 3, then product 3 will be updated such that it has picked product 1.

Regardless as to the Save Format (or Relations Only) the picked values can be obtained via the Property Value Converter.

It should be noted that whilst relations offer two way lookup, querying them can be slow (as it involves a database hit).

Clone this wiki locally