Skip to content

Get issues list filtered by custom field #331

Open

Description

@napless

Hi, i need to get a list of all issue opened filtered by a custom field (id 17) that contain a date (ex. 2019-09-26).
How i can create this?
I've tried with this code, but the filter doesn't work.

`IssueManager issueManager = mgr.getIssueManager();
ResultsWrapper issues = null;

    Params params = new Params()
            .add("set_filter", "1")
            .add("f[]", "project_id")
            
            .add("v[project_id]", projectKey)
            .add("f[]", "cf_17")
            .add("op[cf_17]", "~")
            .add("v[cf_17]", "2019-09-26");
    try {
		issues = issueManager.getIssues(params);
		List<Issue> iss = issues.getResults();
		
		System.out.println(iss);
	} catch (RedmineException e1) {
		e1.printStackTrace();
	}

Activity

  1. alexeyOnGitHub commented on Jan 1, 2020

    @alexeyOnGitHub
    Member

    have you tried the corresponding request via curl, outside of the library? please check if this works first. if this works via curl but does not work in the library, feel free to provide a PR with a fix, please specify your Redmine version in this case since this may be version-specific

  2. napless commented on Jan 2, 2020

    @napless
    Author

    Hi Alexey.
    with this curl, i get the issues that i want to retrieve.

    http://redminefqdn/issues.xml?project_id=29&status_id=*&cf_17=2019-12-11

    I think that the problem is in the "params" variable... could you help me to make right filter params variable?

    Thank you in advance!

  3. napless commented on Jan 2, 2020

    @napless
    Author

    yeeeahh.. sorry for double post, but with this code, i've get the list of issues based on filter applied on custom field 17. :)

    Only problem is that my custom field is a string, but contain a date, and i cannot apply the ">" "<" operator. Could you confirm that this isn't possible?

    Params params = new Params()
    .add("cf_17", "2019-12-11")
    .add("project_id", "29")
    .add("status_id", "*");

    Thank you so much!

  4. alexeyOnGitHub commented on Jan 4, 2020

    @alexeyOnGitHub
    Member

    you can explore Redmine search params by constructing any query with ">=" and similar operands, e.g.
    https://www.redmine.org/projects/redmine/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=o&f%5B%5D=created_on&op%5Bcreated_on%5D=%3E%3D&v%5Bcreated_on%5D%5B%5D=2020-01-01&f%5B%5D=&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=subject&c%5B%5D=updated_on&c%5B%5D=category&group_by=

    then apply the same parameters when calling Redmine using the library. the library simply forwards your params to the server, so whatever your server accepts in the URL should work in the library. with a possible exception when REST calls do not support some operations, which may happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions