0

I am trying to fetch issues based on customField Value.
Tried following but no luck so far. Please help.

Params params = new Params();  

/* Getting params from map*/

for (Map.Entry<String, String> mapEntry : paramMap.entrySet()) {  
          params.add(mapEntry.getKey(), mapEntry.getValue());  
}
    ResultsWrapper<Issue> sqLst;

//1. Didn't work

CustomField customField = CustomFieldFactory.create(cfIdBusinessOwner, "Business Owner", "");  
        customField.setValue("ABC");  
        params.add("custom_fields", customField); 

//2. Didn't work

 params.add("custom_field[" + cfIdBusinessOwner + "]", "abc");

//3. Didn't work

 params.add("cf[" + cfIdBusinessOwner + "]", "abc");

//Continuous Code

params.add("status_id", "*");  
    issueLst= issueManager.getIssues(params);
mitrpathak
  • 91
  • 1
  • 10

3 Answers3

1

After spending a lot of time on the internet finally, I could figure out how to. and it is really simple and straightforward.

params.add("cf_X", "Value");

where X is the id of CustomField and Value is what you want to look for.

I am still trying to figure out how to look for part of the value for given field like we do in SQL like operator '%XYZ%'.

Please help me if someone already has some clue on that.

UPDATE

Found the answer to my second query in the answer above about search with like operator:
Solution:

paramMap.put("set_filter","1");`
paramMap.put("f[]","cf_X");
paramMap.put("op[cf_X]","~");
paramMap.put("v[cf_X][]","PartOfValue");

Where X is the custom field ID and PartOfValue is what you want to search is given field

mitrpathak
  • 91
  • 1
  • 10
0
params.add("cf_X", "Value");

where X is the id of a CustomField and Value is what you want to look for.

Work for me. Also, remember that a Custom field must have 'used as a filter' checked.

Kirk_Hammett
  • 63
  • 1
  • 10
0

While the answers are correct here. This option will work only when the project_id is used along side the cf_X filter

For Eg: http://redmine.com/issues.xml?project_id=projectName&cf_77=Transition

Else this will continue to return all the issues without filtering

Linus
  • 880
  • 13
  • 25