+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Filtering dynamic content items in the backend grid by workflow status

by Stoimen Stoimenov

Since the release of the module builder we've been asked number of times how to add filters to the dynamic items grid view. If you navigate to Content -> Dynamic Type in the sidebar there are only options to view "All" and "My" items which is not enough. Here I am going to show you how to enrich the sidebar in the content type page. For instance news can be filtered by their status – Draft, Unpublished and so on while dynamic items grid view doesn’t have these options. 

Fortunately workflow status filters can be easily added from Sitefinity Settings. To configure it navigate to Administration -> Advanced -> DynamicModules -> Telerik.Sitefinity.DynamicTypes.Model.CustomModule.CustomContentType -> Views -> CustomContentTypebackendList -> Sidebar -> Sections -> Filters -> Items. Create new CommandWidgetElement and set the following properties:

Command name: filter
Command argument: {filterExpression : "ApprovalWorkflowState = \"Draft\""}
Command button type: SimpleLinkButton
Name: DraftItems
CommandText: DraftItems
Type: Telerik.Sitefinity.Web.UI.Backend.Elements.Widgets.CommandWidget

Save and go to Content -> Dynamic Content Type. In the sidebar you can see the new filter and by clicking it the grid is updated only with draft items. To create and other workflow status filters just follow these steps and change the Command argument to:

Published items: {filterExpression : "ApprovalWorkflowState = \"Published\""}
Draft items: {filterExpression : "ApprovalWorkflowState = \"Draft\""}
Unpublished  items: {filterExpression : "ApprovalWorkflowState = \"Unpublished\""}
Scheduled for publishing items : {filterExpression : "ApprovalWorkflowState = \"Scheduled\""}

If you have one or two level workflow the following filters can be applied:

Awaiting approval items : {filterExpression : "ApprovalWorkflowState = \"AwaitingApproval\""}
Awaiting publishing items : {filterExpression : "ApprovalWorkflowState = \"AwaitingPublishing\""}

3 comments

Leave a comment
  1. Steve Jun 04, 2013
    This is just for my own purposes, but filtering by tag syntax

    {filterExpression : "Tags.Contains(\"{E6006A4A-1649-64DF-B54F-FF0000958B81}\")"}
  2. Bart Welch Sep 04, 2013
    Can you open the filter options to use categories in order to only show module items associated with the selected content?
  3. Peter Jan 21, 2015

    Great post!

    The only downside to this is that as soon as you add a field to the dynamic content item through the 'Module Builder' or rearrange it's fields through 'Backend screens tweaks' any custom changes like this get nullified. This is because the custom changes are applied to the DynamicModulesConfig.config file and these changes do not get preserved when a field is added or removed.

    A feature request for this has been created here:

    http://feedback.telerik.com/Project/153/Feedback/Details/99570-module-builder-add-the-ability-to-preserve-customization-to-dynamicmodulesconfig

    Leave a comment