Closed (cannot reproduce)
Project:
Rules
Version:
7.x-2.0
Component:
Rules Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Sep 2011 at 08:52 UTC
Updated:
25 Nov 2018 at 01:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Elementica commentedI think #1283148: Unchanged, updated and saved content all equals for field collection in "Before saving" and "After updating existing" content is just the same problem.
It's driving me crazy a little bit... I'm trying everything but with no hope at all. I just can't get the unchanged value in any way of custom fields. Maybe could also be related to #1167328: Rules integration: [node_unchanged:field_XXXXX] returns updated node content but I've tried the trick (show message with both tokens) and it doesn't work for me.
For my work I'd need at least a temporary solution to retrieve the unchanged value... any idea is welcome!
---
Going on I've tested that in my case only "field_collections" rise the problem... maybe something related to the fact that changing items in collection doesn't change the container itself, so references are overwritten. That is:
node:
changing values of fields "a" and "b" doesn't change "element 1" of collection, but only its content and old values are lost... maybe.
Comment #2
lomo commentedReverted issue title to original since "even on D7" is not a descriptive issue summary for people browsing the queue. ;-)
Comment #3
Elementica commentedNothing yet... after a while I'm back to this problem again... I've just (today) downloaded latest core and revisions of modules (I've updated versione reference in issue settings to 7.x-2.0) and the bug si still there. Any idea is welcome!
Comment #4
SilviaT commentedSame problem here: I'm trying to trigger an action when an existing node is published (but not every time it's updated and published at the same time) and I'd like to use the node-unchanged:status value in the rule conditions, but it seems it doesn't affect the event triggering.
Comment #5
Glenmoore commentedSame again. I need to check that a field has been changed and so I am doing a data comparison but it's coming up TRUE every time.
Comment #6
cbop commentedI'm getting slightly different behavior than described here -- but also the wrong behavior. I'm trying to update the 'created' time-stamp whenever an unpublished article is then published. So, I first created a rule for "Before saving content", which has two conditions: (1) node:status == 'Published ' AND (2) node-unchanged:status == 'Unpublished'. But this never works. In fact, in no case can I get it to update the timestamp when publishing (or unpublishing).
But when I reverse the values, and check for node:status == "Unpublished", and node-unchanged:status == "Published" (exactly the opposite of what I want), it works as I want it to -- when publishing a previously unpublished article. (See attached screenshot of this rule which works).
But this is treating node-unchanged:status and node-status as precisely the *opposite* of what I can only suppose they mean. Shouldn't [node-unchanged:status] contain the value *before* being saved; and [node:status], etc., the *new* values? But they are not behaving that way. But neither are they merely switched, because the opposite values simply never results in any update. This is frustrating. What's up?
Comment #7
cbop commentedUpdate: I found a work-around for my situation -- "Content is published" on [node] and NOT "Content is published" one [node-unchanged] does the trick.
For some reason Data comparisons on node:status and node-unchanged:status are not behaving correctly, but "Content is published" on the respective nodes does work. Strange.
Comment #8
rbrownellComment #9
subhojit777I am not sure whether this is an issue. As pointed out in #6, if I use "Before saving content" it is working; and not working for "After updating existing content". May be we are not reading it right and this is how it works.
Comment #10
kandrupaler commentedFor the problem described by @cbop, what's working for me is the following:
If I check for these two conditions (no and or or blocks added), the condition section evaluates to a TRUE for nodes which have never been published before. And then I can go ahead and change the created timestamp.
Note: If I check only one of the above, the condition section evaluates to a FALSE for nodes which have never been published before.
Comment #11
tr commentedI don't know exactly what everyone was trying (no one posted an export of their rule, most people didn't even mention what event they were using), or whether their use cases are still a problem in the existing version of Rules, but I have tried some simple rules and I can't reproduce this. Specifically, it's not true in general that "$node and $node_unchanged have the same values", although it may be true in certain specific cases that I didn't test because of the missing details about how to reproduce this error.
Regardless, here's an export of one of my test rules. This rule reacts on the "After updating existing content" event and compares the node:title to node-unchanged:title to show a system message if the title has changed. After saving this rule, if I edit only the node body I do NOT see a message, but if I edit the node title I DO see the message. So it works properly, as far as I can tell, and node does have different values than node_unchanged.
Perhaps it was fixed by the two related issues mentioned in #1: #1283148: Unchanged, updated and saved content all equals for field collection in "Before saving" and "After updating existing" content or #1167328: Rules integration: [node_unchanged:field_XXXXX] returns updated node content. (If you look into those, you will see those were resolved years ago by certain other fixes in Rules...). But if this is still a problem for you in the current version of Rules then please export your problem rule, show your work, and explain how to reproduce the problem.
Comment #12
tr commented