0

I am trying to update the 'Search results signature' and Suggestion mode of SXA Search box rendering of items thru below powershell script but it is adding new parameter at the bottom instead of updating the existing parameter

$item = Get-Item -Path "master" -ID "{58FFC28D-D04E-476B-9E59-EEE087A4F54D}"
$renderingItemId = "{EECE4E4B-4E5F-42FD-A934-7AFD048AFD03}"
$placeholderId = "/main/container-1/row-2-2/container-8/column-2-9"

# Accepts Hashtable, Ordered Dictionaries, etc.
$parameters = [ordered]@{"Search results signature"="globalsearch"}
Get-Rendering -Item $item -FinalLayout |
    Where-Object { $_.Placeholder -eq $placeholderId -and $_.ItemID -eq $renderingItemId } |
    Set-RenderingParameter -Parameter $parameters| 
    Set-Rendering -Item $item -FinalLayout

1 Answer 1

0

I just found the below working after some struggle. Like scriban we should be using the template field names which we can find from the parameter template of the rendering.

    $item = Get-Item -Path "master" -ID "{BB57FDB9-7A8F-424B-B59B-94B129E607FD}"
$renderingItemId = "{EECE4E4B-4E5F-42FD-A934-7AFD048AFD03}"
$placeholderId = "/main/container-1/row-2-2/container-8/column-2-9"

# Accepts Hashtable, Ordered Dictionaries, etc.
$parameters = [ordered]@{"SearchSignature"="globalsearch";"SuggestionsMode"="ShowPredictions"}
Get-Rendering -Item $item -FinalLayout |
    Where-Object { $_.Placeholder -eq $placeholderId -and $_.ItemID -eq $renderingItemId } |
    Set-RenderingParameter -Parameter $parameters -Overwrite| 
    Set-Rendering -Item $item -FinalLayout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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