Newbie needs a push in the right direction

Events happening in the community are now at Drupal community events on www.drupal.org.
mixersoft's picture

Hello. I'm brand new to Drupal and the workflow module, and I'm having a little difficulty configuring it to fit my needs. Can someone point me in the right direction? Here is a quick summary of what I'm trying to do:

I'd like to allow users to submit a "story" and then push it through up to 4 different workflow states (i.e. "spelling", "grammar", "fact-checking", etc.) before it can be finally approved or "published" -- for private viewing by the author. Furthermore, I'd like to have a stories in each workflow state put in a queue and then have an "editor" assign the "story" to an internal user ("reviewer") with the appropriate role privilege.

I installed Workflow module and mapped out my workflow states, created a role for each workflow state, and created a user for each role. but I can't figure out how to filter stories by workflow state, (just published/not published) nor how to do any kind of user/role assignment. Or even allow users to just grab ownership of a story/workflow state.

Can anyone tell me how to best approach this problem with whatever combination of modules that are available for either 4.7 or 5.0?

After skimming the available modules, it also occurs to me that it may be possible to implement this same functionality by just having an "editor" assign categories/tags to the stories that match my workflow states to stories; publish the tags to internal users only; and having different user/roles subscribe to the appropriate tag? In this scenario, is there a way for a user to "checkout" a story and grab a lock on it? Maybe just change the tag to something like "spelling-assigned"?

If anyone can point me in the right direction, I would be very grateful.

M.

Comments

For filtering, check the views module

infojunkie's picture

The views module lets you create lists of nodes based on criteria that you define. One such criterion is the workflow state, which you can use as a filter.

The assignment problem is a good question, it should be part of a document workflow implementation IMO. Not sure if our current workflow project requires this as well, but if it does we'll definitely implement it as a new feature.

publishing module

mixersoft's picture

I've been having some success with Workflow by hacking the publishing module. it seems to set a basic framework that I can customize. I can create a 7 state workflow and move a document through it using various users/roles. However, I'm still trying to figure out how to assign ownership to a doc as you suggested above.

One thought that crossed my mind is to just change the author of the document to the assignee, and then filter by author where necessary. Any thoughts on whether this is a good/bad idea?

m.

Using Actions to build dynamic workflows?

mixersoft's picture

Hi, still a newbie, but gaining much experience with workflow. I want to ask if this is a good way to implement multiple workflows with only slight variations.

I have a workflow that has the same sequence of states, but might skip a few steps depending on the exact process. Can I implement this using just 1 workflow, instead a multiple slight variations? I'd like to use an Action triggered by a state transition to skip the following state if appropriate?

I'm picturing a series of checkboxes that are marked at the beginning of the workflow to enable the Actions for skipping workflow states.

If this is a decent idea, can someone point me in the right direction to implement?

Thanks in Advance.

List only States from a Specific Workflow in View

lucast's picture

Yes, we have created multiple workflows each with different workflow states. So yes, it is possible.

The issue we are now having is that we are attempting to create a view using the Drupal Views module to create some dashboards for various content type editors and authors. The problem is that we can create a filter in the view for workflow state, however the list is always populated with all workflow states from all workflows.

This is not what we want since each workflow is only for a certain type of content or process.

Does anyone know how to make the workflow state filter in the Views module show only the workflow states from a specific workflow. Seems that this could be address in the workflow module code but I too an somewhat new to the Drupal platform and am trying to get my head around the views module hooks.

Thoughts?

@lucast "The problem is that

schnizZzla's picture

@lucast

"The problem is that we can create a filter in the view for workflow state, however the list is always populated with all workflow states from all workflows."

You should be able to export your view, save it as a text file. Then it might be the best way to file a workflow support issue attaching your exported view, so others can see how you use the views filter.

I'm using workflow for content moderation on my site. New content has always the status "fresh", assigned automatically by the author on creation. We have a moderation panel, where we use a view that filters all published nodes with workflow status "fresh". It works.

BerlinerStrassen.com
- Support Your Local Heroes!

schnizZzla


BerlinerStrassen.com
- Support Your Local Heroes!

Thanks schnizZzla. It is a

lucast's picture

Thanks schnizZzla.

It is a bit difficult to explain I guess. I am not a noob at development on other platforms in other languages, but PHP and Drupal are a new world. Yipee! I really appreciate the active assistance from the Drupal community.

The problem is that when I add workflow state to a view as an exposed filter, even if I choose "Is One Of" and then pick 6 out of 30 states, the drop down list in the actual view for Workflow States lists every workflow state from every workflow. This includes workflow states outside of the "Is One Of" original filter.

I hope that is a bit more specific. Sorry, did not see an options to attach a txt file so I am including it inline here.

Below is the export of one such view:

$view = new stdClass();
  $view->name = 'periodicupdate_view_workflow';
  $view->description = 'Periodic Updates - Workflow';
  $view->access = array (
  0 => '3',
  1 => '4',
  2 => '5',
  3 => '6',
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Periodic Updates';
  $view->page_header = '';
  $view->page_header_format = '3';
  $view->page_footer = '';
  $view->page_footer_format = '3';
  $view->page_empty = '';
  $view->page_empty_format = '3';
  $view->page_type = 'table';
  $view->url = 'etrack/workflow';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '30';
  $view->menu = TRUE;
  $view->menu_title = 'Workflow State';
  $view->menu_tab = TRUE;
  $view->menu_tab_default = FALSE;
  $view->menu_tab_weight = '0';
  $view->sort = array (
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Project & Language',
      'handler' => 'views_handler_field_nodelink_with_mark',
      'sortable' => '1',
      'options' => 'link',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'year',
      'label' => 'Year',
      'sortable' => '1',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'quarter',
      'label' => 'Qtr',
      'sortable' => '1',
    ),
    array (
      'tablename' => 'workflow_states',
      'field' => 'state',
      'label' => 'Current Step',
      'sortable' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'changed',
      'label' => 'Last Action',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
    ),
    array (
      'tablename' => 'workflow_assign',
      'field' => 'uid',
      'label' => 'User',
      'sortable' => '1',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'periodicupdate',
),
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'year',
      'operator' => '=',
      'options' => '',
      'value' => '2004',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'quarter',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'projectid',
      'operator' => '=',
      'options' => '',
      'value' => '0',
    ),
    array (
      'tablename' => 'workflow_node',
      'field' => 'sid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => '2',
  1 => '36',
  2 => '44',
  3 => '45',
  4 => '6',
  5 => '5',
  6 => '46',
  7 => '37',
  8 => '47',
  9 => '7',
  10 => '48',
  11 => '8',
  12 => '9',
  13 => '49',
  14 => '50',
  15 => '10',
  16 => '11',
  17 => '51',
  18 => '12',
  19 => '13',
  20 => '14',
  21 => '15',
  22 => '16',
  23 => '17',
  24 => '18',
  25 => '19',
  26 => '20',
  27 => '21',
  28 => '22',
  29 => '23',
  30 => '24',
  31 => '25',
  32 => '26',
  33 => '27',
  34 => '38',
  35 => '39',
  36 => '40',
  37 => '41',
  38 => '42',
  39 => '43',
),
    ),
    array (
      'tablename' => 'workflow_assign',
      'field' => 'uid',
      'operator' => '=',
      'options' => '',
      'value' => '-1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '0',
    ),
  );
  $view->exposed_filter = array (
    array (
      'tablename' => 'periodicupdate',
      'field' => 'projectid',
      'label' => 'Project',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '1',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'year',
      'label' => 'Year',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '1',
    ),
    array (
      'tablename' => 'periodicupdate',
      'field' => 'quarter',
      'label' => 'Qtr',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '1',
    ),
    array (
      'tablename' => 'workflow_node',
      'field' => 'sid',
      'label' => 'Status',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '1',
    ),
    array (
      'tablename' => 'workflow_assign',
      'field' => 'uid',
      'label' => 'User',
      'optional' => '1',
      'is_default' => '1',
      'operator' => '1',
      'single' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'status',
      'label' => 'Published',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '1',
    ),
  );
  $view->requires = array(node, periodicupdate, workflow_states, workflow_assign, workflow_node);
  $views[$view->name] = $view;

I understand your problem. I

schnizZzla's picture

I understand your problem. I first thought you meant that the list of nodes is populated with all workflow states.

Now I remember why I didnt use exposed filters for that ;-) You can use local tasks (tabs) for that, but of course that's not the same as an exposed filter. Or even make some fancy panels. For me a bigger constraint than this is that you can't use two workflows on one node. But that's another topic.

Did you search the project issues of workflow and views project for similar issues? Maybe you should really post a feature or support request.

I don't see an easy solution for that, but I'm pretty sure, that some guys who are more experienced hacking workflow or views have some ideas for you.

Good luck!

schnizZzla

[EDIT]
P.S. You can attach files on project issues.


BerlinerStrassen.com
- Support Your Local Heroes!

schnizZzla


BerlinerStrassen.com
- Support Your Local Heroes!

I didn't make anything bold

schnizZzla's picture

I didn't make anything bold or strong in my last post. Strange that it came out bold...

schnizZzla


BerlinerStrassen.com
- Support Your Local Heroes!

Exposed filter with workflow

gubilla's picture

We had a similar issue with exposed filters showing all states from all workflows (basically everything in the workflow_states table). I followed this thread and was able to get a working solution.

http://drupal.org/node/84124

It seems, however, that there would be an easier way to accomplish this. The code referenced in the link above would have to be replicated for each view, which will be a problem as our site grows.

Thanks Gubilla! Sounds like

lucast's picture

Thanks Gubilla! Sounds like this might be a temporary work around but I sure agree with this not being a scalable solution. It really does seem that either the views module should limit the filter selection options to those selected in the "Is One Of" filter selection settings or the workflow module may need to expose workflow ID (wid) and the workflow name as another filter option. You would still then have to have some logic to see that the workflow ID filter is active and therefore only show workflow stages that are used in the specific workflow ID(s).

Workflow

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: