2

I have created two rules to act on some events related to commerce products.

The first is to act on reference node delete event, to remove the product upon node delete.

the second is to delete the node upon expiration event using node_expire

When running the cron to make expired event to be happen no actions executed except if I disabled the first rule

I have tried rules components and rule sets as that two rules have conditions and actions in common But nothing changed.

Edit: I did some debugging and found that warning and error messages

[warning]

WD rules: Unable to load commerce_product with id "102"
WD rules: Unable to evaluate action entity_fetch.
WD rules: Unable to get variable entity_fetched, it is not defined.

[error]

WD rules: Unable to evaluate action entity_delete.

  • Have you tried turning on Rules debugging and/or running the various events using devel's execute PHP functionality? – nvahalik Nov 16 '15 at 22:25
  • display errors is on and no logs in drupal also didn't record any thing – Mohammed Gomma Nov 17 '15 at 13:17
  • Does the first rule work if you delete the node by other means? – Alfred Armstrong Nov 19 '15 at 14:06
  • It works fine and the second rule is the same – Mohammed Gomma Nov 22 '15 at 11:10
0

In your rule, scroll to the bottom, click "Settings" and give the first rule a higher weight than the second.

  • I did with no change the rule didn't apply – Mohammed Gomma Nov 17 '15 at 13:17
0

The error:

WD rules: Unable to get variable X, it is not defined.

means that Rules can't load the variable X.

If you're using contributed modules, please check if your rules are in the right order and the configuration is right, otherwise check the module issue queue for possible bug issues.

If you're using custom modules, please make sure that these rule variables are passed in the correct way.

For example if you've the following sample rule in hook_rules_action_info:

'foo_rule' => array(
  'label' => t('Foo rule'),
  'provides' => array(
    'object_to_send' => array(
      'type' => 'data',
      'label' => t('Data Object to pass'),
    ),
  ),
),

The object_to_send needs to provide the matching array key, e.g.:

return array( 'object_to_send' => $object);

So the next rule in sequence will "see" that variable, so you can use it.

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.