Skip to main content
2 of 2
Added rule export

Rules (not) triggered with Bulk Media Upload

Rules (not) triggered with Bulk Media Upload

I have a node type called 'uploads' that includes a user reference field to make each upload particular/available to a certain user.

I have added a rule so when a new upload is added, they are e-mailed to let them know there's something new for them to see once they're logged in.

This works fine when adding uploads (nodes) one at a time, but I'm also using "Bulk Media Upload" (https://www.drupal.org/project/bulk_media_upload) to allow for multiple uploads/node creation, at which point the rules fail with the following error:

"Unable to get the data value for the variable or parameter id. Error: Unable to get the data property uid as the parent data structure is not set."

I realize that Bulk Media Upload is on/past the outs; but I do need the functionality it provides and am unsure as to why the data isn't available doing things this way when they are doing things one at a time. The references are made the same way in either case since Bulk Media Upload uses/requires the same values.

Edit - Ok, here's the rule being used:

            { "rules_results_uploaded" : {
                "LABEL" : "Results Uploaded",
                "PLUGIN" : "reaction rule",
                "OWNER" : "rules",
                "REQUIRES" : [ "rules", "php" ],
                "ON" : { "node_insert--uploads" : { "bundle" : "uploads" } },
                "DO" : [
                  { "entity_fetch" : {
                      "USING" : { "type" : "user", "id" : [ "node:field-for-user:uid" ] },
                      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
                    }
                  },
                  { "drupal_message" : { "message" : "Receipt of the sample on \u003C?php echo $data[\u0027components\u0027][\u0027sample_received\u0027][\u0027value\u0027][0]; ?\u003E has been acknowledged.  \r\n\r\nAn e-mail will be sent to [entity-fetched:field-practitioner-name] at [entity-fetched:mail]" } },
                  { "mail" : {
                      "to" : "[entity-fetched:mail]",
                      "subject" : "Your Sample Results Have Been Uploaded",
                      "message" : "Dear [entity-fetched:field-practitioner-name],\r\n\r\nNew sample results are now available on your account.",
                      "from" : "[email protected]",
                      "language" : [ "" ]
                    }
                  }
                ]
              }
            }

Again, the rule works fine when fine when adding a new node of the type 'uploads' one at a time, it just doesn't work using bulk media upload (though triggering multiple times.) Perhaps I'm misunderstanding how BMU works.

Any thoughts or alternatives still much appreciated.