mandag den 29. september 2014

Not able to change field values after installing a package with the template having it's fields changed.

Okay, so this is an interresting issue.

First some background - when changing a field on a template in Sitecore to/from "Shared", the value gets moved between the SharedFields table and the UnversionedFields/VersionedFields tables in the database.

This is also why it warns, that changing this might take a while (and also result in data loss, but thats not because of this issue).

If you have items created from a template, where a field is shared, and you install a package that has a new version of the template, where the field is no longer shared, things will break.

In this case, if the field was changed to "Non-shared" using the package installer, you will not be able to change the value on the items based on this template.

This is likely because the value is not moved from the SharedFields table, like it would be if the field was changed from the content editor - resulting in your changes being saved to the right table, but everything being read from the SharedFields table, which is never changed.

You can test this yourself, by following these steps:

  1. Install two identical Sitecore solutions - I'll refer to them as A and B
  2. In A, create a template with a simple text field, make the text field shared.
  3. In A, create a few items based on this template, and fill out the field with some values, and save the items.
  4. In A, make a package with the template and the items.
  5. In B, install the package.
  6. In A, change the template, so the field is no longer shared.
  7. In A, create a package with just the template, and not the items.
  8. In B, install the package, and overwrite the template, template section and template field items.
  9. In B, try and change the value on some of the items, and notice how they will not save when clicking save.
I contacted Sitecore Support with this, and they found sent me a workaround that fixes the issue.

So if you are having this issue, contact Sitecore Support, and ask for support dll #310642 .

Do note, that this has to be installed before the package gets installed, since that is when the fix is applied, that moves the values to the right tables.

Ingen kommentarer:

Send en kommentar