Hi,
I am building a drupal application with a.o. the following modules:
- Drupal 7.4 with Entity 7.x-1.0-beta10 and Rules 7.x-2.x-dev.
I have created 2 content types:
- 'dmat' (a Purchase Request), with a field 'field-dswrequest' that is a checkbox.
- 'dsw_feedback', with a node reference url field called 'field-dmaturlref'.

The rule I sat up should automatically create one new dsw_feedback if the dmat is valid ('field-enabled') and the field-dswrequest checkbox is checked. The event is 'after node content update'.

The rule export gives this pseudo-code:
{ "rules_dmat_processing_step_2b" : {
"LABEL" : "DMat processing step 2b",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "node_update" ],
"IF" : [
{ "AND" : [
{ "data_is" : { "data" : [ "node:type" ], "value" : "dmat" } },
{ "data_is" : { "data" : [ "node:field-enabled" ], "value" : 1 } },
{ "data_is" : { "data" : [ "node:field-dswrequest" ], "value" : 1 } }
]
}
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "dsw_feedback",
"param_title" : "New DSW request for [node:type] [node:title]",
"param_author" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : { "data" : [ "entity-created:field-dmaturlref" ], "value" : [ "node" ] } }
]
}
}

Issue:
------
The rule creates two new identical dsw_feedback nodes instead of only once. This should not do this. Any suggestion?

CommentFileSizeAuthor
Rule screenshot.png200.09 KBSgraffite

Comments

fago’s picture

Component: Rules Core » Rules Engine
Category: bug » support

Turn on the debug log to see what's going on.

burlap’s picture

I might have a similar issue - I have several rules triggered on node update, but to simplify things:

Node:
Field A is empty
Field B is empty

Node update:
Set Field A to "required"
Set Field B to "send email"

Rule 1:
- IF Field A set to "required" AND Field A is empty in node:unchanged
- create a new entity (node)

Rule 2:
- IF Field B set to "send email"
- send email
- set Field B to empty

In short: Rule 2 triggers Rule 1, so Rule 1 is executed twice - (original node update + Rule 2 node update) and I get two new nodes. Rule 1 includes a data comparison to node:unchanged, so it would seem that node:unchanged is the same for both triggers - I wouldn't mind for Rule 1 to be executed again if node:unchanged was updated to reflect changes after the original update (Field A in node:unchanged should be "required").

Sgraffite’s picture

Got that! It works now! Thnx for your support!

Sgraffite’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.