Question

I have customized workbox by overriding it. By default Workbox displays all versions of items in a particular workflow state. I need only the last version to appear in the workbox. Played around with the DisplayStates(IWorkflow workflow, XmlControl placeholder) method, but no luck.

How can I do this?

Was it helpful?

Solution

You need to override DisplayStates() method and filter the DataUri[] items array:

List<DataUri> filteredUriList = new List<DataUri>();
DataUri[] items = this.GetItems(state, workflow);

for (int index = offset; index < num; ++index)
{
    Item obj = Sitecore.Context.ContentDatabase.Items[items[index]];
    if (obj != null && obj.Versions.IsLatestVersion())
        filteredUriList.Add(items[index]);
}
items = filteredUriList.ToArray();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top