Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add options to a cascading multi select list 2nd level using the API

Guido Lerch October 14, 2024

Hi,

I have read several articles but none of the proposed solutions work for me.

I am trying to add a new option to a cascading multi select list; I know how to get the fieldID and the contextID.

 

doing a POST /rest/api/3/field/${this.customFields[0].id}/context/${context.values[0].id}/option adds a new option to the 1st level but how to 1 add a new value to the 2nd level ?
Thanks for helping
Guido

1 answer

2 votes
Adriana Valentina Hernández Moreno
Contributor
November 28, 2024

Hi Guido, 

You should create the parent value first and then add the child value by setting the 'optionId' property, which references the parent ID.

For example:

 

headers = {

"Accept": "application/json",

"Content-Type": "application/json"

}

url = f"https://{jiraInstance}.atlassian.net/rest/api/3/field/{fieldId}/context/{contextId}/option"

payload = json.dumps({

"options": [{

"value": value,

"optionId" : <Here goes the parent ID>

}]})

response = requests.request(

"POST",

url,

data=payload,

headers=headers,

auth=auth

)

I hope this helps.

 

Best Regards

Adriana

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events