• Not Answered

Controller action not called when there is broken link in the rendering datasource

I am using sitecore 8.2 and i have branch template which has few components added when item is created using branch template.For one of the rendering I have given  datasource as "$path/components/component item"  and then in the controller action i am replacing the $path with the path of the page where it is created to make the datasource relative. But the rendering has broken links because of $path and the controller action is not called. Is this expected behavior?

I dont want to use command template here. In earlier version of sitecore it seemed to be working but in 8.2 it is not working

 

Thanks,

JB

3 Replies

  • it should not be related to broken link... issue might be have somewhere else. Controller action should be called.
  • Hi Bharath

    Can you give me the datasource value that caused the issue?

    I am having a similar issue in Sitecore 9. I see corresponding warnings like this in the logs:

    17320 14:35:37 WARN 'query:self::*/Program outline' is not valid datasource for web or user does not have permissions to access.
    17320 14:35:37 WARN 'query:self::*/What to bring' is not valid datasource for web or user does not have permissions to access.
    17320 14:35:37 WARN 'query:self::*/Getting there and parking' is not valid datasource for web or user does not have permissions to access.

    Observe that query uses self::*. I have found that a query like this "query :./Local-components/Body-content" works though. So I believe using self, ancestor etc in the query might not work OK. The frustrating bit is that the controller action won't get called, as you observed.

     

    Update: I read here that self, ancestors work. We still need the ./ after the query:

    For example: 

    query:./ancestor-or-self::*[@@templateid='{F26BC214-E196-4EAA-82BD-3DF7F45D3699}']//*[@@templateid='{D84642E0-9BA7-4E1B-9E8D-737D5CB420DE}']

  • In reply to JawaharSoundappanRamasamy_907626228:

    Hi

    I found the reason for this with the help of Sitecore support.

    This issue can happen in Sitecore 9 as well. The error is thrown from Sitecore.Mvc.ExperienceEditor.Pipelines.Response.RenderRendering.AddWrapper pipeline.

    I believe the error is thrown from another wrapper somewhere in the same space for Sitecore 8.2.

    When I dug deep, I found that the datasource validation expects the data in some format. And "query:/" is not one of those I suppose.

    So, I am about to insert a custom pipeline before that. It would be based on the solution provided in: stackoverflow.com/.../how-do-i-alter-the-renderingcontext-in-a-pipeline

    if (database2 != null && !string.IsNullOrEmpty(dataSource) && (database2.Name != "core" && !this.datasourceValidator.IsDatasourceValid(dataSource, database2)))
    {
    Log.Warn(string.Format("'{0}' is not valid datasource for {1} or user does not have permissions to access.", (object) dataSource, (object) database2.Name), (object) this);
    args.AbortPipeline();
    }