annikoff/redmine_plugin_computed_custom_field

Problem with key/value list

maximkrusina opened this issue · 1 comments

Hi, I have custom field with key/value list.

I would like to set another custom field regarding the value in custom field.
The second custom field is integer, calculated.

Formula is like:

cfs[123]

When i select some value from list in key/value in the issue and try to save it, I got this error:

Error while formula computing in field "Name of field" — undefined method `to_i' for #CustomFieldEnumeration:0x00007fe4c3d11910 Did you mean? to_s

I even tried formula:

cfs[123].to_i

but in this case, formula cannot be saved, getting error:
Formula undefined method `to' for #CustomFieldEnumeration:0x00007fe4c351bd50

PS: final codewill be a little more complicated using case/when/then... now just debugging.

Thanx for help!
Redmine: 3.4.6
Computed custom field: 1.0.6

Hi. Sorry for the delayed response. You could use id method of CustomFieldEnumeration cfs[123].try(:id)