0

I'm working with a snippet that has a class that can be applied to it to make it full width. This snippet represents a carousel with some predefined slides. Upon creating it, things look fine in the default state. Once I apply the global class at the top level, the slide has it's Page Content rendering stripped which cannot be reapplied through ee which says an error occurred. Interestingly enough, I am also not able to reset the final layout after this happens due to the same error. Viewing the snippet in the shared layout shows the page content rendering as it should kind of pointing to the rendering being alright as far as I can tell. In the logs I see the following error:

4432 11:35:23 ERROR One or more exceptions occurred while processing the subscribers to the 'item:saving' event.
Exception: System.AggregateException
Message: One or more exceptions occurred while processing the subscribers to the 'item:saving' event.
Source: Sitecore.Kernel
   at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
   at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
   at Sitecore.Events.Event.RaiseItemSaving(Object sender, ItemSavingEventArgs args)
   at Sitecore.Events.Event.DataEngine_ItemSaving(Object sender, ExecutingEventArgs`1 e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)
   at Sitecore.Data.Engines.EngineCommand`2.RaiseExecuting(Boolean& cancelled)
   at Sitecore.Data.Engines.EngineCommand`2.CanExecute()
   at Sitecore.Data.Engines.EngineCommand`2.Execute()
   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
   at Sitecore.Pipelines.ItemProvider.SaveItem.TriggerDataEngine.Process(SaveItemArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Data.Managers.DefaultItemManager.SaveItem(Item item)
   at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)
   at Sitecore.Data.Items.ItemEditing.EndEdit(Boolean updateStatistics, Boolean silent)
   at Sitecore.Data.Items.ItemUtil.ResetLayoutDetails(Item item, Boolean resetShared, ResetFinalLayoutOptions resetFinal)
   at Sitecore.ExperienceEditor.Speak.Ribbon.Requests.ResetLayout.Execute.ProcessRequest()
   at Sitecore.ExperienceEditor.Speak.Server.Requests.PipelineProcessorRequest`1.Process(RequestArgs requestArgs)

Nested Exception

Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: jsonLayout
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
   at Sitecore.Web.WebEditUtil.ConvertJSONLayoutToXML(String jsonLayout)
   at Sitecore.XA.Feature.Composites.EventHandlers.SaveCompositeItems.GetNewLayoutFromRequest(String newlayout)
   at Sitecore.XA.Feature.Composites.EventHandlers.SaveCompositeItems.PropagateLayoutChanges(Item item)
   at Sitecore.XA.Feature.Composites.EventHandlers.SaveCompositeItems.OnItemSaving(Object sender, EventArgs args)
   at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)

The json device for the page with the snippet has its layout set to JSONLayout. There are no renderings in that device but this is consistent with other pages for the site. I've tried removing the layout in the json device to see if that would change anything but no dice. Any info about this would be appreciated.

Sitecore version: 9.3.0 (rev. 003498)

1 Answer 1

1

I am unable to provide all the information that I need via comment, that's why I posted it as an answer.

This can happens because scLayout property of data object passed via POST request to a server is null. I am not sure why.

Try what you will see if you invoke this (before save)

ExperienceEditor.getPageEditingWindow().document.getElementById("scLayout").value;

this part is used to populate missing property before request

To verify (before save) if it's null open DevTools and enable Preserve log option

enter image description here

Then act like you want to break this page, after reload you can inspect requests

enter image description here

in my case this object look like this

{
    "language": "en",
    "version": 1,
    "isFallback": false,
    "isHome": false,
    "itemId": "%7b4AF614DF-A778-468E-85BE-EAA3B1EA5C28%7d",
    "database": "master",
    "deviceId": "%7bFE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3%7d",
    "isLocked": false,
    "isLockedByCurrentUser": false,
    "canLock": true,
    "canUnlock": true,
    "ribbonUrl": "/s/?sc_mode=edit&sc_itemid=%7b4AF614DF-A778-468E-85BE-EAA3B1EA5C28%7d&sc_lang=en&sc_version=1&sc_site=S",
    "siteName": "S",
    "isReadOnly": false,
    "webEditMode": "edit",
    "requireLockBeforeEdit": false,
    "virtualFolder": "/s/",
    "isInFinalWorkFlow": true,
    "canEdit": true,
    "canReadLanguage": true,
    "canWriteLanguage": true,
    "isEditAllVersionsAllowed": true,
    "isEditAllVersionsTicked": false,
    "canSelectVersion": true,
    "latestVersionResponse": "",
    "itemNotifications": [],
    "argument": "",
    "scValidatorsKey": "VK_SC_PAGEEDITOR",
    "scFieldValues": {
        "fld_4AF614DFA778468E85BEEAA3B1EA5C28_4C2F221F942645ED9EEBC79BB3169565_en_1_38f82c5d6c584d4bad2b4291b223bf38_64": ""
    },
    "scLayout": "{\n  \"r\": {\n    \"@xmlns:xsd\": \"http://www.w3.org/2001/XMLSchema\",\n    \"d\": [\n      {\n        \"@id\": \"{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}\",\n        \"@l\": \"{BCFC7537-EFF4-434C-96F5-BF4F55FD175B}\",\n        \"r\": [\n          {\n            \"@ds\": \"{771A1146-494C-4D85-B97F-1A308D2DF8FC}\",\n            \"@id\": \"{99A633FC-B9A9-44A0-B78A-BCBB08DD02C9}\",\n            \"@par\": \"Reset Caching Options&GridParameters=%7B113BEF7C-97E6-46CA-8CF3-916F7FAA8DE2%7D&FieldNames=%7B4CB9DD5F-7D3F-4673-B7EF-B4FB75517679%7D&Styles&RenderingIdentifier&DynamicPlaceholderId=2\",\n            \"@ph\": \"/main/section-content-1-1\",\n            \"@uid\": \"{E83ABC9C-B9EA-4F8E-9FB1-F82C63A9E046}\"\n          },\n          {\n            \"@ds\": \"local:/Data/12\",\n            \"@id\": \"{00E2C7CF-2247-4596-B878-E6BB3850A77F}\",\n            \"@par\": \"Reset Caching Options&GridParameters=%7B113BEF7C-97E6-46CA-8CF3-916F7FAA8DE2%7D&Styles&RenderingIdentifier&DynamicPlaceholderId=1\",\n            \"@ph\": \"main\",\n            \"@uid\": \"{09A63A74-0402-4AA8-A4AD-61B590955534}\"\n          }\n        ]\n      },\n      {\n        \"@id\": \"{0B4A31C9-712D-4578-A396-2DDC0F34B63A}\",\n        \"@l\": \"{72C595AD-68BB-44BC-B5CD-2A857039515F}\"\n      }\n    ]\n  }\n}"
}

This should be also helpful if you want to find a place where value is assigned to the context inside Save command

enter image description here

To be honest I am not sure if it's a valid/acceptable case/behavior or not (null value in for scLayout property - if it is null). If not then it means that something went wrong in SPEAK. If yes then it means that SXA cannot handle this case right now because it assumes that it is always present in the request.

Hope it helps.

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.