Console icon indicating copy to clipboard operation
Console copied to clipboard

Add-ItemVersion does not copy any field values

Open annaf-dev opened this issue 1 year ago • 2 comments

Expected Behavior

Using Add-ItemVersion without the flag -DoNotCopyFields creates a new language version and copies all field values from the source to the target language version.

Actual Behavior

Using Add-ItemVersion without the flag -DoNotCopyFields only creates a new language version but does not copy any field values to the newly created target language version.

Steps to Reproduce the Problem

Sitecore PowerShell Extensions 6.4.0.16859 Sitecore 10.2

  • Make sure you have at least two languages, where one uses the other as fallback language, e.g. en and en-US (using en as fallback language)
  • Add new item (with at least one normal (text) field) in language "en"
  • Get the item via powershell command and execute Add-ItemVersion -Item $item -TargetLanguage "en-US" (without any other flags)
  • New en-US version is created, but the field value is not copied from en to en-US - instead it's using the fallback value.

For me it seems that the ShouldProcessField condition is not correctly evaluated and therefore no field value is copied (line 131). Maybe the variable itemWasCreated needs to be set to true after creating the new language version in line 122.

annaf-dev avatar Nov 17 '23 09:11 annaf-dev

Thank you for reporting the issue. I'll have a look and see if I can reproduce it. Could you describe a sample template with fields that I can setup to reproduce the issue? Include details such as is the field shared/unversioned, etc.

michaellwest avatar Nov 17 '23 14:11 michaellwest

@michaellwest - I cannot reproduce it, unless you can - I propose we close this. @DeathAngelDaemon - can you provide details regarding the language fallback configuration for the instance and the site the item is in?

AdamNaj avatar May 12 '24 16:05 AdamNaj

Closing as not reproducible and we lack the reporter response to act on it further. Feel free to reopen if needed.

AdamNaj avatar Jul 25 '24 15:07 AdamNaj