private List<WorkflowAction> GetWorkflows() { var actions = new List<WorkflowAction>(); if ( CurrentPerson != null ) { using ( var rockContext = new RockContext() ) { var categoryIds = GetCategories( rockContext ); var qry = new WorkflowService( rockContext ).Queryable() .Where( w => w.ActivatedDateTime.HasValue && !w.CompletedDateTime.HasValue && w.InitiatorPersonAlias.PersonId == CurrentPerson.Id ); if ( categoryIds.Any() ) { qry = qry .Where( w => w.WorkflowType.CategoryId.HasValue && categoryIds.Contains( w.WorkflowType.CategoryId.Value ) ); } foreach ( var workflow in qry.OrderBy( w => w.ActivatedDateTime ) ) { var activity = new WorkflowActivity(); activity.Workflow = workflow; var action = new WorkflowAction(); action.Activity = activity; actions.Add( action ); } } } return actions; }