0

I created 2 rules with the same action, which sends Drupal logs to the site. One is Content is created with the After saving new content (rules_entity_insert:node) event; the other one is Content is updated with the After updating content (rules_entity_update:node) event. Also, they use the same Condition: Node is of type condition.

I am using a REST request to create/edit a node. However, when I do a POST, I am getting 2 logs in the site, which means that both rules are being triggered. PATCHing a node is working fine: A single log is created.

Am I missing something?

I am using the Rules module 8.x-3.0-alpha3. The action is programatically created.

6
  • To rule out that the REST POST request is doing something strange when creating a node, I assume that you have tested creating content manually - using the normal Drupal node creation form? It is also helpful if you add which version of Rules you are using.
    – hansfn
    Aug 2 '18 at 9:33
  • the result is the same when creating the content from web. Already added the rules version. Aug 2 '18 at 9:42
  • 1
    If 8.x-3.0-alpha3 (May 2017) really is the version you are using, then I suggest updating to rules 8.x-3.0-alpha4 (May 2018). Still the same problem? If so, check the Rules issue queue ;-)
    – hansfn
    Aug 2 '18 at 11:05
  • I did update into alpha4, still no luck. Aug 2 '18 at 12:43
  • So it looks like a bug then. Search the issue queue - and maybe post a new issue?
    – hansfn
    Aug 2 '18 at 14:01
0

Problem solved by https://www.drupal.org/project/rules/issues/2990211#comment-12716081

I have another rule that modify the title of my node with event After updating content (rules_entity_update:node). But since that rule is necessary, then it should not be deleted but still I dont want to get a duplicate result when a node is created. So what I did, is I change the other rule that modifies the title into event Before saving content (rules_entity_presave:node) so it wont be called on node creation, and this works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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