Derek Dysart

Derek Dysart


Periodic notes from an independent Sitecore Developer/Architect

October 2018
M T W T F S S
« Dec    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories


Field Name Collisions in Sitecore Powershell Extensions

Derek DysartDerek Dysart

I had a situation where I needed to do a bulk update to a whole bunch of dictionary items that were part of a translation dictionary. On the dictionary entry template, there is a field called ‘Key’ which is also the name of a property on the Sitecore.Data.Items.Item class. I turns out that any field names that collide with properties on this object get an underscore in front of their name. For example, where I needed to get at the ‘Key’ field, I simply needed to write my Powershell command as:

Get-ChildItem -Recurse | Where-Object {$_.TemplateName -e “Dictionary Entry”} | ForEach-Object {$_._Key = $_.Name}

This particular PSE command will reset the Key field of all the Dictionary Entry items to its name.

Independent Sitecore developer. I also blog about other stuff from time to time.