0

The following is the code which i'm using to update the field values of a rendering.

$item = Get-Item -Path "master:\content\ListManagerTask\Adding Contact"
Get-Rendering -Item $item -PlaceHolder "main" | 
    Foreach-Object { 
        Write-Host "$_.ChildRenderings.ToString()"
        $_.DataSource = $null 
        Set-Rendering -Item $item -Instance $_
    } 

I need to assign value to parameters template. But there is no such property.

Can anyone help me out in fixing this issue.

1 Answer 1

1

In order to add rendering parameters via Sitecore Powershell, you should make use of the set-renderingparameter. It accepts a Hashtable or dictionary of key value pairs.

$item = Get-Item -Path "master:\content\ListManagerTask\Adding Contact"

$parameters = @{"SampleKey2"="SampleValue2"}

Get-Rendering -Item $item -PlaceHolder "main" | 
    Foreach-Object { 
        Write-Host "$_.ChildRenderings.ToString()"
        $_.DataSource = $null 
        Set-RenderingParameter -Parameter $parameters | 
        Set-Rendering -Item $item -Instance $_
    }

Note that I have not yet tested the script but you can find more information at

Sitecore Powershell Extension - Set-RenderingParameter

Sitecore Powershell Extension - Set-Rendering

1
  • 1
    I believe this requires an installation of 5.1. Jul 25, 2019 at 12:57

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.