Console
Console copied to clipboard
Add-ItemVersion does not copy any field values
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
anden-US
(usingen
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 fromen
toen-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.
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 - 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?
Closing as not reproducible and we lack the reporter response to act on it further. Feel free to reopen if needed.