Populating the custom fields of a newly created Jira Issue using Atlassian SDK and C#

0

So I have an annoying little problem rn; I've never worked with the Atlassian SDK before and I'm having trouble creating a new issue for which I need to provide certain required custom field values. When I try the following code everything goes fine until it tries to save the issue, at which point it complains that the custom fields are expecting an object.

using Atlassian.Jira;

...

var jira = Jira.CreateRestClient("https://example.one.loc", "TEST_Jira", "abc123!");

            var issue = jira.CreateIssue("AMI");

            issue.Reporter = Environment.UserName;
            issue.Summary = summary;
            issue.Description = description;
            issue.Assignee = Environment.UserName; // temporary until we figure out who this should be
            issue.Type = "Service Request";

            issue.CustomFields.AddArray("Service Type Detail", string[] { "Merchandise Credit" });
            issue.CustomFields.AddArray("Macro Process", new string[] { "ABC" });
            issue.CustomFields.AddArray("Work Group", new string[] { "Credit" });
            issue.CustomFields.AddArray("Work Type", new string[] { "Request" });

            await issue.SaveChangesAsync();

The error message I'm receiving is a follows:

System.InvalidOperationException HResult=0x80131509 Message=Response Status Code: 400. Response Content: {"errorMessages":[],"errors":{"customfield_10701":"expected Object","customfield_10603":"expected Object","customfield_10702":"expected Object","customfield_10703":"expected Object"}} Source=Atlassian.Jira

Any ideas as to what form my custom field parameters should be in or any other mistakes I'm making?

Thanks!

c#
.net
jira
asked on Stack Overflow Jun 5, 2020 by Kee • edited Jun 5, 2020 by Kee

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0