Skip to main content
deleted 198 characters in body
Source Link
jrap
  • 5k
  • 1
  • 23
  • 45

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.

Note: Unsharing a field requires a background operation to complete. To the best of my knowledge TDS does not trigger this background operation. Be mindful of the change that needs to occur.

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.

Note: Unsharing a field requires a background operation to complete. To the best of my knowledge TDS does not trigger this background operation. Be mindful of the change that needs to occur.

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.

Source Link
jrap
  • 5k
  • 1
  • 23
  • 45

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.

Note: Unsharing a field requires a background operation to complete. To the best of my knowledge TDS does not trigger this background operation. Be mindful of the change that needs to occur.