Filtering Jira tickets by custom field data using .NET SDK

I’m using the Jira .NET SDK and need help with searching tickets based on custom field values. My tickets have a custom field called ‘AssigneeId’ and I want to find all tickets where this field equals a specific value like ‘456’.

Here’s what I attempted:

var ticketQuery = from ticket in _jiraService.Issues.Queryable
            where ticket.CustomFields.Any(field => field.Name == "AssigneeId" && field.Values.Contains(targetId)) && ticket.Project == _config.ProjectName
            select ticket;

This throws an error about JQL syntax being invalid. The error mentions unexpected characters in the query. What’s the correct approach for querying Jira issues using custom field criteria?

LINQ queries with custom fields often don’t translate properly to JQL. I’ve faced this issue previously; try constructing the JQL string directly instead: string jql = $"project = {_config.ProjectName} AND cf[10001] = '{targetId}'"; var issues = await _jiraService.Issues.GetIssuesFromJqlAsync(jql);. The key is identifying the custom field ID (like cf[10001]) rather than using the display name. You can find the field ID in the Jira admin settings or by executing a test query to observe the response format. The SDK’s LINQ provider typically struggles with Any() operations on custom fields.

yeah, LINQ gets messy with custom fields. i skip the queryable stuff and just use JQL directly: var jql = "project = YourProject AND AssigneeId ~ 456"; then call GetIssuesFromJqlAsync(). heads up - sometimes you’ll need the actual cf number instead of the field name, depends how your Jira’s configured.

Your LINQ approach won’t work - the Jira SDK can’t convert complex LINQ expressions with custom fields into proper JQL. I hit this same issue building a ticket management system. Use GetIssuesFromJqlAsync with raw JQL instead. Here’s what the other answers missed: you need to figure out if your Jira instance uses the field name directly or needs the custom field ID format. Try the field name first like project = "ProjectName" AND AssigneeId = "456". If that bombs, check your Jira custom field config for the actual field identifier. Some setups take field names in JQL, others only work with the cf[xxxxx] format.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.