3

I've used Create a new entity for the Rules event After updating existing content, but nothing happens.

Is it a bug?

Update:

Here is an export of my rule:

{ "rules_update_order" : {
    "LABEL" : "Update Order",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update" : [] },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "comment",
            "param_subject" : "Something",
            "param_node" : [ "node" ],
            "param_author" : [ "node:author" ],
            "param_comment_body" : { "value" : { "value" : "Something", "format" : "filtered_html" } }
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      }
    ]
  }
}

It is a very simple rule. And I have a lot of rules which are easily fired apart from this one.

Some more Debugging information (contained in my Rules Logging):

0 ms Rule Update Order fires.
0.873 ms Evaluating the action entity_create.
33.717 ms Unable to create entity comment": Invalid data value given.
          Be sure it matches the required data type and format.
36.05 ms Unable to evaluate action entity_create.
36.099 ms Rule Update Order has fired.
3
  • This is the third comment + rules question from you today.. Do you have rules debugging enabled? If not, enable it and check the log. Then add that to this question. Feb 29, 2016 at 16:33
  • There seems to be a unwritable error that happens with comments so it would be beneficial to know if that's the problem. Feb 29, 2016 at 16:34
  • OK, I'll check. Feb 29, 2016 at 16:39

1 Answer 1

2

Part 1: Understanding the problem

It takes a little time/effort to get used (and become experienced) in using the Rules module.

My experience is that it is rare to find a bug in the Rules module. Most of the cases where I experience something in Rules that deviates from what I expected, I can find out what "my" problem is by using debug-facilities available for the Rules module.

So 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).

Depending on what the result of that type of debugging is, you may also want to (temporary) enable the Devel module, so that you can (temporary) add a Rules Action like "Display a value".

For more suggestions about Rules debugging, refer to "How can I display the value of a variable inside a condition?"

Part 2: Examples of creating comments after updating existing content

Sorry to say, but I disagree with this comment that was posted below this answer:

It seems that it cannot work in this way and it is not possible to create a comment with this event.

Have a look at these answers, which are about questions that are variations of the question here:

Part 3: Experiment with other text formats

Even though your question doesn't provide any details about the text formats you are using, IMO it could well be that your actual issue is caused by the Text format that you're using for the comment body: your rule shows you're using filtered_html, but you should definitely give it a try to experiment with other text formats, such as plain_text.

PS: this answer is about D7 ...

3
  • I can't do anything with comments when the rules are related to After saving a new content or After updating existing content. It simply doesn't work. Feb 29, 2016 at 16:22
  • Hm, that extra comment about "a lot of rules" may be part of what is causing your problem. To somehow avoid any other (concurrent) rules actions, you may want to (temporary) disable those rules that might be related to it. Keep in mind: debugging an issue = removing all possible causes, one by one ... until you find the one that is what you were looking for ... Feb 29, 2016 at 16:44
  • It seems that it cannot work in this way and it is not possible to create a comment with this event. Feb 29, 2016 at 16:54

Your Answer

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

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