Note that there are some explanatory texts on larger screens.

plurals
  1. POHow To Select Item In Sitecore Content Editor
    primarykey
    data
    text
    <p>I've got a Sheer UI wizard that collects information from a user and then creates a content item in sitecore. The wizard is launched using an command template.</p> <p>I'd like the wizard to make the newly created content item the currently selected item in the content editor but I can't work out how to do this. Does anyone know how this is done?</p> <p><strong>Update</strong></p> <p>Trayek's advice has got me a bit further. I've now got the following code in the Command I use to launch the wizard:</p> <pre><code>[Serializable] public class MyNewContentCommand : Command { public override void Execute(CommandContext context) { ClientPipelineArgs args = new ClientPipelineArgs(); args.Parameters["id"] = context.Parameters["id"]; Context.ClientPage.Start(this, "Run", args); } protected void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { // This runs when the users clicks to add the item // in the content editor. // Launches a modal wizard to collect user data string id = args.Parameters["id"]; string controlUrl = Sitecore.UIUtil.GetUri("control:MyNewItemWizard"); UrlString urlStr = new UrlString(controlUrl); urlStr.Append("id", id); SheerResponse.ShowModalDialog(urlStr.ToString(), true); args.WaitForPostBack(); } else if (args.HasResult) { // This runs once the wizard has finished // Wizard passes ID of created item in its result // This is used to find the newly created item. Item created = Client.GetItemNotNull(ID.Parse(args.Result)); // Sending these messages result in refreshing the child items // of the parent. And they work. Context.ClientPage.SendMessage(this, string.Format("item:updated(id={0})", created.Parent.ID)); Context.ClientPage.SendMessage(this, string.Format("item:refreshchildren(id={0})", created.Parent.ID)); // This message should select the new item in content editor, but // it doesn't have the desired effect. Context.ClientPage.SendMessage(this, string.Format("item:load(id={0})", (object)created.ID)); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload