Skip to main content
Share Your Experience: Take the 2024 Developer Survey
3 of 3
Component updated
geraldo
  • 405
  • 3
  • 19

Rules Scheduler Component parameter is empty

I created a rule for scheduling a action component after 48h. The rule gets triggered correctly and the task shows up at the "Workflow" tab in rules.

The problem is that the scheduled component gets an empty parameter and so can execute the actions. Drupal log shows an "The variable or parameter node is empty." warning.

Here is the rule:

{ "rules_set_submission_status_to_archived" : {
    "LABEL" : "SUBMISSION: Set submission status to archived",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "archived", "submission" ],
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "node_insert--submission" : { "bundle" : "submission" } },
    "IF" : [ { "entity_is_of_type" : { "entity" : [ "node" ], "type" : "node" } } ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_times_up_for_submission",
          "date" : "+2 days",
          "identifier" : "Archive submission [node:nid] \u0022[node:title]\u0022 after 48h.",
          "param_node" : [ "node" ]
        }
      }
    ]
  }
}

Here is the scheduled component:

{ "rules_times_up_for_submission" : {
    "LABEL" : "Times up for submission, archive and pay back credits",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "TAGS" : [ "archived", "submission" ],
    "REQUIRES" : [ "rules", "commerce_credits", "php" ],
    "USES VARIABLES" : { "node_to_archive" : { "label" : "Node", "type" : "node" } },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node-to-archive" ],
          "type" : { "value" : { "submission" : "submission" } }
        }
      },
      { "entity_has_field" : { "entity" : [ "node-to-archive" ], "field" : "field_status" } },
      { "data_is" : { "data" : [ "node-to-archive:field-status" ], "value" : "submitted" } },
      { "entity_has_field" : { "entity" : [ "node-to-archive" ], "field" : "field_use_free_credits" } },
      { "data_is" : { "data" : [ "node-to-archive:field-use-free-credits" ], "value" : "0" } }
    ],
    "DO" : [
      { "commerce_credits_add" : {
          "entity" : [ "node-to-archive:author" ],
          "credit_type" : "credit",
          "number" : [ "node-to-archive:field-submission-price" ]
        }
      },
      { "data_set" : { "data" : [ "node-to-archive:field-status" ], "value" : "archived" } },
      { "entity_save" : { "data" : [ "node-to-archive" ], "immediate" : "1" } },
      { "php_eval" : { "code" : "watchdog(\u0027schedule\u0027, $node_to_archive);" } }
    ]
  }
}

So basically, the node is not passed to the scheduler component. Is there something broken in my system or do I miss something?

geraldo
  • 405
  • 3
  • 19