Updating a Linked Content Reference on Existing Content

In Agility, Linked Content fields allow you to reference another content item/list. The is helpful for creating relationships between content items or nesting lists within an item. The Reference Name of the Linked Content list is actually stored on the main/parent content item itself as a string.

When you create content items, a copy of that Reference Name is stored on the content item. If you later change the Linked Content property for that definition to point to another item/list then the old Reference Name will still be saved on each previous version of the content items. Any new content items you create will get the new Reference Names.

This can cause unintended consequences in your code where depending on which content item is accessed, you may get a different linked content reference.

A similar problem can occur if you add a new linked content property - by default, any existing content item will have a NULL value for that new property until you update the existing content item in the Content Manager.

Workarounds

If you are stuck in this state, there are a few things you can do to update the linked content references on the older content items:

  1. You can temporarily change the type of the Content Definition to a Text field and manually update the value to the Reference Name of the list/item you'd like to reference. Once you're done, change it back to a linked content list.

  2. Use the Export/Import functionality in Agility to update the previous items' linked content reference value.

  3. Use the Content Import API to update these values programmatically.

 

Future Considerations

Agility is looking at how we can make this more transparent so that developers understand, within the CMS, the consequences of updating a linked content reference value and what tools can be introduced to automate this.

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.