Current content for PropertyList item selection factory


When attaching a SelectOne or SelectMany attribute to a POCO object property being edited as part of a PropertyList property, the ExtendedMetadata object only contains the POCO object. The Model property is null, and it seems there's no way of getting the current content being edited, i.e. the current IContent object.

public IEnumerable GetSelections(ExtendedMetadata metadata)
        var currentContent = metadata.FindOwnerContent(); // This is null

I briefly had an idea of getting the current content by parsing the URL, but since the URL is for the selection factory store, that doesn't help me much - that URL doesn't contain any information about the current content context.

Any bright ideas? :)

Jan 20, 2016 23:23

That is basically what is done in the FindOwnerContent method. I don't think it works for PropertyList

Jan 21, 2016 10:22

Thanks, Marija! I'm not sure that works, though?

It would normally, but when editing a PropertyList item (i.e. a POCO object) the selection factory REST store request simply includes the name of the selection factory type - there is no content context information.

That code sample could be replaced with the FindOwnerContent extension method, but regardless I still get null back. :/

Edit: Right, like Per said. :)

Edited, Jan 21, 2016 10:23


Old thread, I know! But... did you ever find a soloution for this? I'm running into the same problem :)

Jan 23, 2018 11:32

If you have latest version of Epi and it still doesn't, it sounds like it should be reported as a bug to Episerver support. I couldn't find a bug report, see this.

Jan 23, 2018 11:51

I got this answer from Episerver today 2018-06-19

"We're developing a story that will fix this issue. The story will be released in CMS UI 12 that requires some breaking changes."

Jun 19, 2018 10:49
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.