Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Was working fine with 7.x-2.9, Now Variables are undefined, even if i rename it to a new name it is still. Undefined.
Unable to get variable variablename, it is not defined.
when i rename variablename to variablename2,
Rules Error: The Data Selector variablename for the parameter parameter name is invalid.
within the Rule i change The Data selector to variablename2. and i still get the error.
Unable to get variable variablename2, it is not defined.
Comments
Comment #2
GOJR CreditAttribution: GOJR commentedComment #3
GOJR CreditAttribution: GOJR commentedComment #4
GOJR CreditAttribution: GOJR commentedComment #5
Matroschker CreditAttribution: Matroschker commentedI can confirm this - with 7.x-2.9 it works with our rules, but now after the update to 7.x-2.10 we got this error in the log:
Unable to get variable assigned_products, it is not defined.
Comment #6
GOJR CreditAttribution: GOJR commentedI had to regress to 7.x-2.9 for the moment until this get fixed has i don't see how i can fix it from 7.x-2.10.
Comment #7
activelink CreditAttribution: activelink as a volunteer commentedThis issue appears to be caused by Views Bulk operations, rather that Rules itself. I can confirm that I had this problem, and I was in the process of setting up some new, manually triggered VBOs, for my site, when I realised that the Workflow module also had a similar problem when working with VBOs: A VBO that uses "Change workflow state of post to a new state" works, but one that uses "Change workflow state of post to next state" fails (it sets the workflow state to the same state that it's already in, and returns an "Unable to get variable variablename, it is not defined. error". It seems that the function "views_bulk_operations_action_load_id_list" in file "views_bulk_operations_views_list.inc" is returning the workflow states out of sequence, and this is causing the problem that we are seeing here in Rules.
I applied the patch from https://www.drupal.org/node/2862858#comment-12001237 and also the one from https://www.drupal.org/node/2853029#comment-11949835 - both patching the VBO module's "views_bulk_operations.rules.inc" and these appear to have eliminated this problem.
Comment #8
mvonfrie CreditAttribution: mvonfrie commentedThis bug is not only related to VBO. I have a custom rule action with three parameters, two integers and a node which is optional. My constellation is a node with an entity reference to an entity, and the entity can only be edited by the user via Inline Entity Form of the node edit form. Thus when creating a new entity (and a new node as well) the rule reacting on the entity creation fails with this bug. At the time of inserting the entity of course the node doesn't exist and cannot be provided to the rules action. In my situation
RulesState::get($name)
is not aware that the parameter is defined as optional and it should returnNULL
instead of throwing the exception.Comment #9
TR CreditAttribution: TR commentedCould someone please provide an export of a (simple) rule that demonstrates this problem? What action is this, what data type, how have you configured it, etc - all of these will be answered by the export so we don't have to guess and endlessly try different things to try to reproduce this error.
Comment #10
TR CreditAttribution: TR commentedComment #11
dzy CreditAttribution: dzy commentedI am using rules 7.x-2.12.
after user save comment, i want flag this node as [he has reviewed this node] something like that.
Comment #12
TR CreditAttribution: TR commentedPlease simplify this export to include only the things necessary to reproduce the error. For example, the error says: "Unable to evaluate condition flag_flagged_node." so I suspect you will still have that problem if you remove all the actions and remove your second condition. Likewise, can you write this Rule to use one of the built-in content types like article or page so we don't have to guess at what your "comment_node_enroll" content type looks like? Also, please describe how you configured the flag on the content type.
Yes, this requires you to do a little work, but without complete information we will not only have to recreate your content type and fields, but we will have to guess at how you've configured them. If we can't reproduce the error that may simply mean we just guessed wrong.
So please simplify the problem first before you export the Rule.
Comment #13
dzy CreditAttribution: dzy commentedI tried as you suggested, but couldn't reproduce the problem using the article type. I guess this may be related to my custom permission.
I used the hook_comment_insert() and node_load() function. Maybe somewhere the return value did not pass comment successfully. I'll try again another day.
Comment #14
TR CreditAttribution: TR commentedComment #15
wutu CreditAttribution: wutu commentedAfter update to 7.x-2.12 I have same error.
Rules: