SitecorePowerShell/Console

Get-Item behaves weirdly when dealing with Checkbox fields having "false" (empty)

hugosantos-konabos opened this issue · 2 comments

Expected Behavior

Get-Item should handle FALSE checkbox values as FALSE instead of inheriting its value from the standard values item.

Actual Behavior

Get-Item handles FALSE checkbox values as EMPTY, thus inheriting its value from the standard values item.

Steps to Reproduce the Problem

Create one template that has a checkbox field. Set its default value to TRUE.

Now create an item using this template. You will see that Sitecore uses its default value, so the value is TRUE.

Manually unselect this checkbox. It's now FALSE. But if you open the "raw values", you will see that Sitecore stores an "empty" value that means FALSE. Behind the scenes, Sitecore is smart enough to know that this EMPTY is actually FALSE and do not inherit its default value from standard template item.

SPE is doing the opposite. When facing an empty boolean field value, SPE is getting the standard value template. Here is a short SPE script and its results to show this:
image

Both checkboxes "Use Global Header" and "Use Global Footer" have "TRUE" as standard value. But as you can see, the source item already had those two fields set to "FALSE". After copying them to the target database, those fields are now back to "TRUE" again.

@hugosantos-konabos Can you demonstrate that this issue still occurs without the use of SPE? I suspect this is the behavior of the platform and not something introduced by SPE.