Closed vomus closed 1 year ago
I am not very much of a Ruby expert. This works in the console when I experimented:
iss = Issue.Find(2722)
iss.custom_value_for(5).value = Time.now.strftime('Note.%d%m%H%M%S-%y')
iss.save!
but this does not work inside custom_workflow:
@issue.custom_value_for(5).value = Time.now.strftime('Note.%d%m%H%M%S-%y')
You can set the value of a custom field in before_save
callback:
self.custom_field_values = { '5' => Time.current.strftime('Note.%d%m%H%M%S-%y') }
Check FAQ, there are plenty tips how to use plugin features https://github.com/anteo/redmine_custom_workflows/wiki/Frequenly-Asked-Questions#how-can-i-access-and-manipulate-custom-fields
Yeah, I also found/figured a little other way
icf = IssueCustomField.find_by_name('Note id')
self.custom_field_values = { icf.id => Time.now.strftime('Note.%d%m%H%M%S-%y') }
so one does not need to poke in the DB to look for a custom field id... Thanks.
Hi! is there any example somewhere I can look at to see how to set a value for a certain custom field at a particular task?