Trying to use "String" Custom Fields for datetimes and fill it automatically
Added by Gurvan Le Dromaguet over 11 years ago
Hi,
Similarly to "Closed Date" field that was added recently, I need to record other key dates for tracking. For this I would need:- "DateTime" Custom fields (as in: http://www.redmine.org/issues/11044)
- Trigger mechanism (eg on State change, update field)
- Using a Custom field type "String" to record date times with a fixed predefined format (eg: 2013/09/01 16:41 UTC), quite easy in Ruby:
dnow=DateTime.now
dnow.strftime("%Y-%m-%d %H-%M-%S UTC") - For triggers, I thought I could add a method in issue.rb update(), but can't get it to work.
2 problems: How to get the former state ? How to update the custom field ? I tried this:http://stackoverflow.com/questions/16958500/creating-and-populating-redmine-custom-fields-by-ruby-code but no luck my field is never updated (and I have big troubles understanding the code)
Did anyone code successfully such a mechanism ?
Thanks