9

I have a bunch of templates that have a Coveo Search Box View rendering associated with the standard values. I need to update the property "Reveal Advanced Query Suggestions" of all of them(a lot of templates in this case) and set them all to checked = false. Although I could manually update them all I'm looking for an automated way of doing such a task. Anyone have done anything similar using Sitecore PowerShell? I do have the PowerShell documentation and if I spend some time and play with it I'll figure that script on my own just wondering if anyone has ever done anything similar that they could share?

Thanks

2
  • Is that property on the rendering parameters or on the item?
    – Richard Seal
    Commented Sep 28, 2016 at 18:06
  • The property is a rendering parameter
    – Diego
    Commented Sep 28, 2016 at 18:08

1 Answer 1

12

Quick test confirms that the following allows you to set a rendering parameter on existing items.

# Path to the Coveo rendering you need to update
$rendering = Get-Item "master:\sitecore\layout\Sublayouts\Sample Sublayout"

# Update this value for the path of all the templates whose std vals you wish to update
$items = Get-ChildItem -recurse master:\sitecore\templates\Sample

$items | % {
    $renderingInstance = Get-Rendering -Item $_ -Rendering $rendering
    if ($renderingInstance) {
        Set-Rendering -Item $_ -Instance $renderingInstance -Parameter @{
            # Put new/changed rendering parameter name and value here
            # Other existing values should be unchanged by this
            "Lorem" = "Ipsum"
        }
        Write-Host "Updated $($_.Paths.FullPath)"
    }
}

More information:

2
  • exactly what I was looking for. Thanks techphoria414
    – Diego
    Commented Sep 28, 2016 at 20:08
  • As soon as I can get Gitbook to build this example will be added. Commented Oct 2, 2016 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.