1

I am using the Atlassian.Jira NuGet package in my web app.

I can successfully query Jira using built in fields for example Project, ResolutionDate etc. but I cannot use a custom field.

I have a custom field named "Organizations" and I want to add this to my query where it is equal to a certain string.

Here is my query:

var issues = from i in jira.Issues.Queryable
where i.Created >= dateFrom &&
i.Created <= dateTo && i.Type != "Change" && i["Organizations"] == organization
select i;

I have tried the following:

i["Organizations"] == organization

Returns 400. Operator ~ not supported.


i["Organizations"].ToString == organization

Returns Index was out of range. Must be non-negative and less than the size of the collection.

Sounds like there is nothing to return but I can see issues in the portal.


I also tried:

i.CustomFields["Organizations"].Values[0] == organization
  1. Response Content: {"errorMessages":["Error in the JQL Query: Expecting a field name but got ')'. You must surround ')' in quotation marks to use it as a field name

Though I don't think it is supposed to be used this way.

Any help is appreciated!

2 Answers 2

0

Try to use the LiteralMatch instead of ==. LiteralMatch is like ~ operator in JQL.

where i.Created >= dateFrom &&
i.Created <= dateTo && i.Type != "Change" && i["Organizations"] == new LiteralMatch(organization)
select i;
Sign up to request clarification or add additional context in comments.

Comments

0

I got same problem. I resolve by this query:

List<Issue> list = (from i in (IQueryable<Issue>)jira.Issues.Queryable
                                    where i.Project == ProcessConfiguration.ParentProjectKey
                                    && (DateTime)i.Created >= (DateTime)jiraSelectInputDto[0].FromDate
                                    && (DateTime)i.Created <= (DateTime)jiraSelectInputDto[0].ToDate
                                    && i["Customer"] == new LiteralMatch(cusProvince.Province)
                                    orderby i.Key descending
                                    select i).ToList();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.