C# Rest Client get the value of a Customfield?

I have burned up 2 days trying to figure out how to code in C# the means to find a value in a Custom Field.

using Atlassian.Jira;

var jira = Jira.CreateRestClient(url, username, password, settings);
var test = jira.Projects.GetProjectAsync(“ABCD”).Result;

works perfect. But I cannot figure out how to use to get a value of a specific Custom Field for a Project?

THANKS!!! a head of time if you can help me.

Hi @TimothyBusbice , welcome to the developer community.

By any chance, are you using Atlassian.NET SDK by farmas? If so, I am not sure if that’s an official Atlassian SDK.

But to answer your question, if you are referring to getting a custom field value for a specific issue and not a project, then I think this should work:

var issue = await jira.Issues.GetIssueAsync("ABC-1");
var customFieldValue = issue["myCustomField"];

If you are indeed referring to getting the value of a custom field for a project, I do not have an answer to that yet.

Cheers,
Ian

Ian:

Thanks, I was using farmas but switched to what I think, through NuGet, is the Atlassian SDK. I am looking for the value of a Custom field which I still cannot obtain. Your code did not work for me but it could be my ignorance. Any suggestions is much appreciated. Specifically, I’m trying to get to the value marked in the screen shot below.

Is this the one you are using? If so, based on the copyright, it is the one by farmas. How are you retrieving the custom field values given the issue object? Based on their docs the custom field should be referenced via name.

I definitely had that one installed with no luck but I’ll keep trying.

1 Like

Hi, your solution works for text field, but my custom field is “Multiselect List” so it is giving only one selected value event if there are more than one selected values.

1 Like

Welcome to the Atlassian Developer Community, @ChetanLohade.

Kindly check their documentation located here. For multiple values, you might want to try

var issue = await jira.Issues.GetIssueAsync("ABC-1");
var multiValue = issue.CustomFields["myCustomField"].Values; 

Cheers,
Ian

Hi, solution works as expected.
Thanks for quick response.

1 Like