I have the following dummy controller trying to use https://github.com/cassidydotdk/Sitecore.Datalift

public class MyController : DataLiftController
    public ActionResult Index()
        var actionItem = GetActionItem("User Defined/MyProject/Pages/MyItem");

        if (actionItem == null)
            return new EmptyResult;

        var viewModel = new ViewModel()
            Title = actionItem["Title"]

        return View("~/Views/MyView.cshtml", viewModel);

However, I always get null for actionItem. What am I doing wrong? I am expecting the actionItem to return context item unless I have datasource then return datasource. However in both instances I get null.

1 Answer 1


Sitecore.Datalift follows the normal pattern of trying to grab the Datasourced item, falling back to Context.Item if no datasource has been set.

While I can't tell from your code exactly what is failing, the normal caveats would be:

  1. You've not defined your datasource. If so; your code above expects Context.Item to have a template that is or inherits User Defined/MyProject/Pages/MyItem
  2. You have defined a datasource, but it points to an invalid or non-existing item. If so, GetActionItem will always return null.
  3. The datasource you have defined is valid, but the item pointed to is or does not inherit User Defined/MyProject/Pages/MyItem
  • No. 2 fixed it for me. Thank you. The item wasn't publishing as expected.
    – Anicho
    Oct 3, 2016 at 23:56

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.