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

Retrieving value from key/value custom field #172

Closed kty0mka closed 4 years ago

kty0mka commented 4 years ago

When using key/value type custom fields custom_field_value(cf_id) returns us key (enumerator id). Is there any way to fetch value?

For example: Custom field (key/value) possible values:

I want test if my custom field has orange value, but instead of set value I get 3 (enumerator id of value "orange").

AirTibu commented 4 years ago

Hi,

Maybe you can use this:

CustomFieldEnumeration.where(:id=> custom_field_value(cf_id).to_s,:custom_field_id => 'cf_id').first

I hope this helps!

kty0mka commented 4 years ago

Hi @AirTibu,

Thanks! It works) I think that second filter (:custom_field_id => 'cf_id') is unnecessary, because every value has unique enumerator id. Anyway thank you very much!