I am using SXA 1.8.0 with Sitecore 9.0.2 on multisite solution. I have a branch template for a page template which creates a few renderings data sources underneath this page, like that:

        Rendering 1
        Rendering 2
        Rendering 3

The current solution architecture does not allow me to bind these renderings on the page partial designs and they need to be added to the placeholders on the page directly. I am trying to find the best way to do it hence this question.

I think about writing PowerShell scripts to bind these items to the suitable placeholders and maybe add the script in the scaffolding so it will be invoked every time after the item creation (similar to the site/tenant creation).

The issue I see here is that I am not sure how I can actually obtain the current context item in this case in PS without giving the root explicitly so I will be able to get the page item in whatever site it has been created. Also, I do not know if this is really possible to add these scripts to the branch as scaffolding. Maybe writing a script targetting every item of particular page template and going through the CMS tree recursively would be a better option in here?

Do you have any ideas about how this could be done in the easiest way?

1 Answer 1


One option is to use the Insert Item integration. With this approach you will have the context item and you can make your script do whatever it is you want.

Let's say for example you have a script library like the following:

Example Script Library

The Simple Insert Item script will run with access to the context item. From here you can perform any magic you want in the script.

Potential magic includes:

Insert Options

$path = $SitecoreContextItem.Paths.Path
Show-Alert -Title "Magical script running to create new items under $($path)."



Your Answer

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

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