Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to set the CustomField value of an "Array" type field in C# ?

Andrej191
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2024

hi, 

I am using Atlassian SDK to create issue. I have a problem setting a value for a custom field. It always ends with this error :

"customfield_15870":"Invalid format. Expected an array of objects with either an Option ID or an existing value."

I use something like this to set the custom field value

string name = "my_field_name";
string value = "my_field_value";

issue.CustomFields.Add( name, value);

 

 I also tried to create the value like this:

 

string value = $"{{\"value\":\"{value}\"}}";
string value = $"{{\"id\":\"{value_id}\"}}";

but nothing helped.  I also tried to use the  issue.CustomFields.AddArray method , but it also failed. 

This problem only occurs with one particular custom field. There is no problem with the others.

Thanks for any advice.

1 answer

1 accepted

0 votes
Answer accepted
Andrej191
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2024

Solved via REST API. The problematic field was the custom field "cascading select". I do not think there is a way to set it using the Atlassian SDK, but the REST API can be used as a workaround.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2024

Hi @Andrej191 -- Welcome to the Atlassian Community!

As you solved your own question, do you want to mark this one as "answered"?  That will help others in the community with similar needs find solutions faster.  Thanks!

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events