Closed (fixed)
Project:
Rules
Version:
6.x-1.4
Component:
Rules Engine
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2009 at 00:40 UTC
Updated:
22 Apr 2011 at 16:01 UTC
I'm trying to add a new rule that updates the date within a specific field ("last updated by student") to the current date. The field is a standard CCK Date field with custom input format (yyyy-mm-dd), granularity set to the day.
In Rules, I've created a new triggered rule and set my conditions. But I'm having trouble setting the action "Populate a field". I've tried all of the following variations of tokens in the field;
But with all of these attempts I always get the error: "Last updated by student is invalid." - and whatever I entered in the field gets replaced with "2009-01-01".
Any pointers toward how I can get this to work would be greatly appreciated!
Comments
Comment #1
itsnotme commentedNot sure we've got the same problem but at least it seems related :)
Tokens didn't work for me at all.
So I tried with
but the field still doesn't get filled. I suspect it's got to do with "Content going to be saved" and that the field is already saved before it is attempted to change the value. At least, that seems to be my favorite problem to run into... would also take pointers.
Comment #2
YK85 commentedsubscribing
Comment #3
itsnotme commentedSolution:
In the PHP field, the following has to be entered:
Comment #4
klausiReopen if still an issue.
Comment #5
michellezeedru commented@itsnotme - thank you, that worked perfectly!
Comment #7
voskuh commentedHi,
I reopen this issue because I have a support request following this issue. I want to update a date field with a time 15 minutes in future. I tried different php snippets that don't work. The date field is updated to the current date and time and not 15 minutes in future.
The php snippets I used.
and
Why don't these snippets work? And much more important: how can I achieve what I want? :-)
Thanks in advance
Comment #8
itangalo commentedConcerning #7
I think this may be because of the time field you're using -- there are three different date fields, and they might store their values differently. My suggestion is that you install the Devel module, and check the devel tab on a node to see how the date value is stored. Then make your PHP output mimick that.
Good luck!
//Johan Falk
PS: It is generally a good idea to open a new issue rather than re-opening a closed one if it is not the very same issue being discussed.
I'm a part of the Rules Issue Squad, helping out in the issue queue. You can join, too!
Comment #9
itangalo commentedOops. Closing.