5

We are having difficulties getting an update to a Template to deploy properly. Take the example structure below:

 - Template Item
 - - Section Item
 - - - Field Item 1
 - - - Field Item 2

The items that we need an update are Field Item 1 and Field Item 2. In a previous deployment, these Template Fields were set to Shared. Now, however, we need to 'unshare' these fields.

We are using Update Packages coupled with Sitecore Package Deployer for pushing item changes.

Sitecore 8.2u5

TDS 5.7.0.7

1 Answer 1

6

The issue is inherent with the way Sitecore handles checkbox fields and how it serializes items.

Checkbox Field

Checkbox fields in Sitecore can have 3 values:

  • Blank (not set)
  • 0 (unchecked)
  • 1 (checked)

Blank and 0 are interpreted as the same value of false value when reading the fields on an item through the Item API.

Serialization

During serialization (the technique TDS uses for reading items) a field with a blank value is not written to disk. Only fields with values 0 or 1 are written out. This is a Sitecore-ism. TDS uses the Sitecore API for serialization.

Problem

When using the UI (in Content Editor for example) and checking/unchecking a checkbox, the field value toggles between Blank and 1.

Solution

The only way to achieve a value of 0 is to select Raw Values from the View tab. Enter a 0 into the checkbox field and save the item. Re-sync in TDS and if you inspect the corresponding *.item file, you will see the field listed properly.

Now when the Update Package is installed, it will explicitly set the value and uncheck the field.

1
  • 1
    I'm fairly sure it does trigger this. Changing the field sharing on any template field must go via TemplateManager.ChangeFieldSharing - and this method triggers the job on the DataProvider level. I would consider it a serious bug, if TDS was to bypass this.
    – Mark Cassidy
    Commented Jan 17, 2018 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.