When creating Umbraco.BlockList with Items programmatically they are not showing, how to 'publish' them?

When I create a blocklist with this as the Umb.PropertyEditorUi.BlockList with that has this in the database for table

umbracoDataType: {"blocks":[{"contentElementTypeKey":"d0eeca25-ed03-4282-af88-eebfd2a003f6","label":"{umbValue: eventItemTitle}"}]}

I create it as this, the same as if i create it from the backend only the “key” and matching “contentKey” values are generated by me:

{
  "contentData": [
    {
      "contentTypeKey": "d0eeca25-ed03-4282-af88-eebfd2a003f6",
      "udi": null,
      "key": "cd58fb64-091f-4dbf-ba61-6d028fd580a3",
      "values": [
        {
          "editorAlias": "Umbraco.TextBox",
          "culture": null,
          "segment": null,
          "alias": "eventItemTitle",
          "value": "test"
        }
      ]
    },
    {
      "contentTypeKey": "d0eeca25-ed03-4282-af88-eebfd2a003f6",
      "udi": null,
      "key": "d2f4cfa5-6b44-42dd-bca9-d17cef767526",
      "values": [
        {
          "editorAlias": "Umbraco.TextBox",
          "culture": null,
          "segment": null,
          "alias": "eventItemTitle",
          "value": "test2"
        }
      ]
    }
  ],
  "settingsData": [],
  "expose": [
    {
      "contentKey": "cd58fb64-091f-4dbf-ba61-6d028fd580a3",
      "culture": null,
      "segment": null
    },
    {
      "contentKey": "d2f4cfa5-6b44-42dd-bca9-d17cef767526",
      "culture": null,
      "segment": null
    }
  ],
  "Layout": {
    "Umbraco.BlockList": [
      {
        "contentUdi": null,
        "settingsUdi": null,
        "contentKey": "cd58fb64-091f-4dbf-ba61-6d028fd580a3",
        "settingsKey": null
      },
      {
        "contentUdi": null,
        "settingsUdi": null,
        "contentKey": "d2f4cfa5-6b44-42dd-bca9-d17cef767526",
        "settingsKey": null
      }
    ]
  }
}

When I change 1 key by a key that is created in the backend, I get the 2 showing but 1 shows ‘in Draft’.
Do I need to do something to create those keys? Currently I just create them with a new Guid.

Hopefully someone can give me a quick answer because I don’t see it. Thanks in advance!

Did you find a solution to this? I’m having a similar issue

I actually asked to remove the post because it was a stupid mistake from my end. The contentTypeKey in one element didn’t match the guid for that contentType. Normally it should work when they match. When all elements don’t match it doens’t anything. But when 1 matches and another not that one will shows ‘in draft’ for that item. But else it should work.

I don’t think it’s stupid. And other people might make the same mistake and find an answer here. So I wouldn’t delete the post :slight_smile:

1 Like