Project

General

Profile

how to search issue by custom field value

Added by I K over 9 years ago

Hey guys,

I want to do something like this:
Issue.where('custom_field_value == something')
So, to find a issue by a custom field. How is it possible?
thanks!


Replies (2)

RE: how to search issue by custom field value - Added by Martin Denizet (redmine.org team member) over 9 years ago

I think you have to search the custom values, something like:

CustomValue.where('value = something and type = "Issue"')

You can also specify the custom field you want if you don't want to search in all custom fields.
Note that I wrote this from memory and it's very likely I did some typo.

RE: how to search issue by custom field value - Added by Nikolay Ruban over 9 years ago

Issue.custom_field_value contains Array of CustomFields object's.
Values for custom fields are stored in the table custom_values, where fields: customized_id is Issue.Id and custom_field_id points to id in custom_fields table.

Correct me if Im wrong, but proper way of searchng through custom fields would be search trough CustomValues.

    (1-2/2)