anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
182 stars 72 forks source link

save custom field user #284

Closed cbmarchetti closed 2 years ago

cbmarchetti commented 2 years ago

Hi, I need to save custom field values to users.

Any idea??

self.custom_field_values = { 147=> CustomValue.where(:customized_id => @user.id.to_s, :custom_field_id => '131').first.to_s} self.save_custom_field_values image

picman commented 2 years ago

You must consider the situation when a user is being created (doesn't exist yet). So, this code would work:

unless new_record?
  self.custom_field_values = { 147=> CustomValue.where(customized_id: @user.id, custom_field_id: 131).first }
  self.save_custom_field_values
end
cbmarchetti commented 2 years ago

thanks for the support!