I'm a developer with some experience with using the Workflow module+Actions to manage the state of nodes and things that happen when nodes change state. I'm working on a new project now where I need a relatively complex workflow. Basically, we are developing a sort of Question and Answer board where the questions and answers need to be reviewed before they can post, so, for instance, all answer nodes associated with a question node have to be approved before the question node will be moved to a published state. While looking at the workflow module project page I found a link to the Workflow group, and then from there a link to the Rules group. I've installed both modules and it seems like they both fill different needs, but the way Rules is promoted it sounds like Rules is supposed to be able to handle workflows.
So, my question is, how are the two related? If Rules is supposed to be a superior replacement to Workflow, how would I go about setting up a similar workflow in Rules, where the content moves through various user-defined states (i.e. I need more than just the published/unpublished state)? Would Rules be able to help me out in my specific situation where I have interdependent node states?
Comments
rules is useful for doing
rules is useful for doing workflows, but not a workflow solution on its own. In 5.x there was even workflow-ng integration for the workflow module, which allows one to use the workflow module together with flexible rules. However I don't know if this has been ported to 6.x yet.
It's also possible to do it by using rules & cck. Create a new cck field for the state and use actions to react on changes of this field. You can set permissions for this field with the CCK permissions module shipped with CCK, so that only a certain group of people is allowed to change state. You can publish/unpublish the node easily with rules by using the appropriate action - or if you need more you can alter it's node access by using the content access rules integration...
Rules with content access
Rules with content access rules intergration can set view and edit per node but how can i grant access per field?
content permissions
the only way to set permissions per field is by using the content permissions module. However there is no rules integration for that..
I think it would make sense to do a small field permission module which sets the field permissions by node state or offers rules integration, e.g. an action to set custom field permissions.
Rules detect workflow state
If your rules module can intergrate some condition like current workflow state, previous workflow state, and can set action like set transition permision by role, set workflow fields permission by role, I think it will be the perfact solution for every complex workflow. There is Workflow Fields module which can set permision per field by state.
Now I use both workflow (and workflow fields) module with rules, when a workflow state change I set an action like promoted node to frontpage, and then detect this by rules' condition, is there any way better to detect workflow state?
As said above, there was
As said above, there was already workflow workflow-ng integration for 5.x - however I don't know it has been ported yet to rules. That should do it.
Get the mentioned integration ported, if it isn't yet...
There is Workflow Fields
Great! That is the solution that I am struggling for between workflow-state and ruls module. I am going to have a try right now!
I have tried out the
I have tried out the workflow field module, but it's not exactly what I am looking for. Using this module as the alternative for workflow-state-integration as rules EVENT will lose at least below major advantages that the nature workflow comes with:
So, I would suggest if the rules module could integrate the changing of workflow states as an event, it will solve all these problems, and that is the most nature way to use. I really look forward to see this to happen because the workflow state is a must feature in my sites.
Anyway, I want to thank Fago and other people to creat such a great module as Rules and I wish it can go further!
BTW, I have tried to write an event for workflow after reading all documents linked on Rules' module page, but I found it is impossible for my PHP and Drupal-api familiarity.
I have a question when set
I have a question when set field value by Triggered rules.
Event : Content is going to be saved
Action: Populate a field.
Value: Saved content : Advanced: Specify the fields value with PHP code
Which PHP code I have to use to specify this field by node author' role. For example:
node author in role 'A' will return 'Department 1'
node author in role 'B' will return 'Department 2'