2

I am working on SPEAK UI in Sitecore.

I have created the button, Which is named as Edit Meta under content/webedit/ribbons/webedit in core database. This button will be shown in Experience Editor section when I click Edit Meta button. I need to show the Data in a popup window related to that particular Meta section. I gave the command name, script file path, Access Key in button layout properties.

When i click the button in Experience Editor it shows below error.

A serious error occurred please contact the administrator

I un-commented the code which is related to SPEAK ui in sitecoreMvcExperienceEditor.config also. I have added Sitecore.Support.122942.dll also.

I checked the log file and it shows Could not instantiate speak request object. Please suggest how to resolve this issue?

I followed below steps.

  • I logged into core database using Sitecore Rocks.
  • I have created the Item(Meta) using strip template under Content/Applications/Webedit/Ribbons/Webedit/ in core database and given the Header Name and Id .
  • Added strip layout for Meta Item in presentation details.
  • Created the Item Under Meta by using Chunk template, given HeaderName and Added Chunk layout in presentation details.
  • Created another item(EditMeta) under Meta chunk using Largebutton template & given the Header name also.
  • Added the LargeButton rendering for MetaData in presentation details.
  • I have edited the property details of Largebutton rendering. below I mentioned the property details of Largebutton rendering.
  • enter image description here

My Js file.`

define(["sitecore", "/-/speak/v1/ExperienceEditor/ExperienceEditor.js"], function (Sitecore, ExperienceEditor)


{

Sitecore.Commands.LaunchFieldEditor =
{
    canExecute: function (context) {
        return true;
    },
    execute: function (context) {


        context.currentContext.argument = context.button.viewModel.$el[0].accessKey;

        ExperienceEditor.PipelinesUtil.generateRequestProcessor("ExperienceEditor.GenerateFieldEditorUrl", function (response) {

            var DialogUrl = response.responseValue.value;
            var dialogFeatures = "dialogHeight: 680px;dialogWidth: 520px;";
            ExperienceEditor.Dialogs.showModalDialog(DialogUrl, '', dialogFeatures, null);
        }).execute(context);

    }
};
});

`

My class:

public class GenerateFieldEditorUrl : PipelineProcessorRequest<ItemContext>
{


public string GenerateUrl()

{
    var fieldList = CreateFieldDescriptors(RequestContext.Argument);
    var fieldeditorOption = new FieldEditorOptions(fieldList);
    //Save item when ok button is pressed
    fieldeditorOption.SaveItem = true;
    return fieldeditorOption.ToUrlString().ToString();
}
private List<FieldDescriptor> CreateFieldDescriptors(string fields)
{
    var fieldList = new List<FieldDescriptor>();
    var fieldString = new ListString(fields);
    foreach (string field in new ListString(fieldString))
        fieldList.Add(new FieldDescriptor(RequestContext.Item, field));
    return fieldList;
}
public override PipelineProcessorResponseValue ProcessRequest()
{
    return new PipelineProcessorResponseValue
    {
        Value = GenerateUrl()
    };
}
}

I added the reference in Sitecore.ExperienceEditor.SpeakRequest.config

<configuration>
<sitecore>
    <sitecore.experienceeditor.speak.requests>
        <request name="ExperienceEditor.GenerateFieldEditorUrl" type="Website.Modules.Components.ExperienceEditor.FieldEditor.GenerateFieldEditorUrl, Website.Modules" />
    </sitecore.experienceeditor.speak.requests>
</sitecore>

Could you please suggest, how to fix this issue?

thanks in advance

  • 2
    Please open Sitecore logs, see what errors/exceptions happened around that time, and include those error messages as a part of your question. – Dmytro Shevchenko Mar 2 '17 at 8:05
  • 2
    I'm voting to close this question because it is incomplete - without enough information to diagnose the issue - and possibly a bit off-topic. It looks like what the author really needs is some help getting through a tutorial/walkthrough, and I would expect that better help could probably be found by asking the question in Sitecore Community Slack – Zachary Kniebel Mar 3 '17 at 18:01
  • Putting the question on hold for now, awaiting clarification. Reopened 07/03/2017 – Mark Cassidy Mar 3 '17 at 21:28
3

with in Sitecore.ExperienceEditor.Speak.Server.RequestArgs class the method name to execute defaults to Process. Check the last line in below method.

public RequestArgs(string commandPath, NameValueCollection queryString, string data)
  {
   Assert.ArgumentNotNull(queryString, "queryString");
   this.QueryString = queryString;
   this.Data = data;
   string[] array = StringUtil.RemovePrefix('/', StringUtil.RemovePostfix('/', commandPath)).Split(new char[]
   {
    '/'
   });
   Assert.IsTrue(array.Any<string>(), "Missign request name");
   this.RequestName = array[0];
   this.MethodName = ((array.Length == 1) ? "Process" : array[1]);
  }

Either you have to create your request as ExperienceEditor.GenerateFieldEditorUrl/ProcessRequest

Or change the method below in GenerateFieldEditorUrl class to Process from ProcessRequest

public override PipelineProcessorResponseValue ProcessRequest()
  • Disclaimer: I work with Indra who created the question. Spent good 1 hour to reflect and found the answer – phani Mar 9 '17 at 19:58
  • 1
    Nothing wrong with answering questions here, that you solved offline :-) Just make sure you provide full question explanation, and full answers :-) – Mark Cassidy Mar 9 '17 at 20:40
0

Please look at your log file.

  • There may be many scenarios:

Scenario 1 (I was facing this issue): Social Media is disabled in your configuration file but related items do exist in CORE database.

ERROR: Error processing command url:/-/speak/request/v1/expeditor/ExperienceEditor.Social.SocialCenter.GetMessagesCount error:System.InvalidOperationException: Could not retrieve request class for url:/-/speak/request/v1/expeditor/ExperienceEditor.Social.SocialCenter.GetMessagesCount at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.Process(HttpContext context) at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.ProcessRequest(HttpContext context) Solution: Remove these two items from CORE DB:

Solution: Remove these two items from CORE DB: • /sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Social • /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Social


Scenario 2: URL Rewrite issue with SPEAK request
ERROR Error processing command url:/-/speak/request/v1/expeditor/optimization.activeitemtest error:System.InvalidOperationException: Could not retrieve request class for url:/-/speak/request/v1/expeditor/optimization.activeitemtest

Solution: Well explained in given blog (However, this was not the problem I was facing). https://codeandnuts.wordpress.com/2017/04/19/sitecore-experience-editor-issue-a-serious-error-occurred-please-contact-the-administrator/

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.