A item is created as part of a SPE script via the Insert Item integration, very similar to the current workflow in Sitecore -- the new item is added as a child of the item we inserted a new item on, except the script performs some additional tasks behind the scenes. What is the best way to allow the user to navigate to it after the script has completed?

script complete window

The workaround I am doing for now is to show this as part of the script output window:

Write-Host "CLICK to view the new item:
Write-Host "{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}"

The ID is represented as a clickable link, and it will open the item in a new popup window. It does so by performing a network call to /sitecore/shell/Applications/PowerShell/PowerShellIse?sc_bw=1 with a parameter of item:load(id={1D803A5D-42E4-4523-9952-ACFAA9FDBDE3}.

Ideally, I would leverage functionality that mimics the workflow of vanilla Sitecore item insertion; i.e. right click --> insert, then once the script is done, the tree refreshes and shows the new item in real time and focuses on it.

  • Can you provide the example of the script you are trying to execute the create item? Feb 20 at 7:47
  • The script is relatively straightforward. The workflow is meant to mimic a normal case where you would right click an item and insert a new item (which triggers the script in this case) -- then behind the scenes, the script performs additional actions. Feb 20 at 13:28

1 Answer 1


Here are a few options.

Show-Output and JavaScript (source)

#... your code here with various helpful Write-Host outputs

Show-Result -Text

# After the Show-Result window is closed, this triggers the redirect
$script = ('window.top.location = "/sitecore/shell/Applications/Content%20Editor?fo=' + $item.ID +'"')
Invoke-JavaScript -Script $script`

I like this approach because:

  1. The user can be shown the result/output of the script.
  2. After closing the result window, the user will automatically be shown the item in the Content Editor and the item tree will remain visible, so it's not too disorienting, despite the page reload.

Show-Application (source)

Show-Application `
    -Application "Content Editor" `
    -Parameter @{id ="$($item.ID)"; fo="$($item.ID)"; 
                 la="$($item.Language.Name)"; vs="$($item.Version.Number)";

The window loads with the content tree view disabled unless the user manually enables it via the ribbon (VIEW --> check "Content tree). However, you can pass the -Modal flag which seems to open the window with the content tree on the left.

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.