3

I want to change the workflow state to draft from publish and unpublished the node on edit. I used rules for this:

  • For Unpublish:

    enter image description here

  • For publish:

    enter image description here

When I edit a node and save it, workflow state changes to draft through Rules and again changed to published state.

enter image description here

I have not set any trigger settings.

Please suggest what could cause this.

2
  • Hi Pierre! thanks for your reply, it helped me to debug the issue from rules and I got into this conclusion that it is not because of rules as my rule is running once for un-publish and no Publish rule is triggered! still the content is getting published.
    – Anamika
    Commented Oct 25, 2016 at 10:19
  • "debugging" is the art of taking away all possible causes, 1 step at a time. Looks like you got a little bit further, though I have no other inspiration about what else it could be that you're still struggling with. Suggestion: why not add an "update" to the end of your question, with something like "after some rules debugging, I now know that it is not because of rules. So now my remaining question / thoughts are like so and so ..."? Commented Oct 26, 2016 at 14:04

2 Answers 2

2

Option 1

Rules is great, but sometimes also tough to debug if things don't work as you'd expect. There are typically 2 ways of debugging, as further detailed below.

Rules Evaluation Log

Within the Rules settings, experiment a bit with the debugging facilities that come with the rules module. At least have a look at the "Rules Evaluation Log" (to check that the Rules logic being executed, actually matches what you expect that logic to be).

Rules Action to display a value (using devel)

You may also want to (temporary) enable the Devel module, so that you can (temporary) add a Rules Action like "Display a value".

Obviously, make sure that there are no Rules Conditions that would prevent the rules Action(s) from being executed (if needed temporary remove such Rules Conditions).

More info

For way more details about these 2 variations, move on to Rules debugging, as explained in the answer to "How can I display the value of a variable inside a condition?".

Option 2

Try to consolidate your 2 rules in a single rule, by using the Conditional Rules module. This module allows you to use Rules Conditions within Rules Actions. So in your case if you can think of an appropriate Rules Event that fits both cases, you simply use the Rules Conditions and Rules Actions within such consolidated single rule, whereas you use Conditional Rules to trigger either (not both!) of your Rules Actions.

3
  • expect rules is there any other way where I can manage node to be unpublished on edit?
    – Anamika
    Commented Nov 1, 2016 at 9:58
  • 1
    @Anamika : I "assume" that the using some type of custom code is another way to unpublish a node. Commented Nov 1, 2016 at 11:55
  • @Anamika merci for the (late) accept! Commented Dec 28, 2017 at 10:08
0

Not sure if I got your problem, but here are few pointers based on my understanding

  • Ensure the order in which your rules are getting invoked if the rule with publishing action is invoked in the last it will anyway publish the node.
  • Event for your rule for unpublishing the node is 'before saving content of type Document', can you changing it to update updating existing content of type Document' to make sure there is nothing in place which triggers during and after presave hook.
5
  • Unpublished rule has high priority than publish. Whatever the state I change its auto change to Publish. I made the change to before saving content of type to Updating existing content of type Document. but the issue is still there
    – Anamika
    Commented Sep 29, 2016 at 10:37
  • Can you disable you publishing rule for a while, and see if unpublish rule works?
    – arpitr
    Commented Sep 29, 2016 at 10:54
  • I tried those as well as you can see in workflow history image the unpublish rule is working (One with comment) and with that some other instance is also running. I have enabled Workflow action module does it has to do anything regarding this?
    – Anamika
    Commented Sep 29, 2016 at 10:58
  • 1
    Could be, just to add my two cents you should look are for anything rule triggered during/after same events if so disable them, look for custom code changing the state if so comment it, target is to make unpublish rule working which seems to work fine as you said, next is finding what is overriding your rule. For debugging the rules, enable rule debugging by visiting admin/config/workflow/rules/settings and turn on logging.
    – arpitr
    Commented Sep 29, 2016 at 11:08
  • I enabled rules debug but the condition for Publishing is shows as false.. and no other rules are getting fried. Is there any other settings available where the workflow state could be changed?
    – Anamika
    Commented Sep 29, 2016 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.