Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

Add values to select list via automation

David Loszewski
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.
April 6, 2022

I'm trying to find a way to add values to a single select list via automation or workflow.   Is there any way to currently do this?   I've searched but unable to find a solution so far.   I found the following which matches my use case but am not sure how to implement: https://stackoverflow.com/questions/22892537/how-to-add-new-values-to-select-list-field-in-jira-dynamically-or-using-plug-in/23198416#23198416

 

2 answers

2 votes
Samuel Bartolome April 8, 2022

Hi @David Loszewski ,

Using automation or workflow post-function are easy ways to accomplish what you are looking for.

Are the values predefined (always the same) or do they come from a different field?

https://confluence.atlassian.com/automation/advanced-field-editing-993924663.html would give you a hint on how to update a field with automation. 

You can set the updated field with a permanent field, iterate an if-else based in some values so the field is updated based on another or copy value from another field.

 

The native post-function is a bit restricted on updating fields, so it will depend on which plugins you may have

David Loszewski
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.
April 8, 2022

@Samuel Bartolome I think your response assumes that I already have the values in the field.  I may not have been clear.  I'm trying to add an option/value to a single select list which, typically this is done manually through Issues -> Custom Fields -> <Field in question> -> Contexts and Default Values

I'm trying to accomplish the same thing through automation and/or addon script.   

The following is my use case: 

1. Single Select List Custom Field: Customers 

2. Text Field: New Customer

When a person enters a form with a value in New Customers, I want that value to be added as a list option on Customers.  

Like Kerry Kreppein likes this
Samuel Bartolome April 8, 2022

Not sure you can achieve that  with automations, but probably you can do it with Scriptrunner as a listener maybe. 

In Scriptrunner there is already a build-in option (on-prem) to update values of fields in bulk, so  with that and the listener (if available in Cloud), it may do the trick

Tina Xu November 22, 2022 edited

jira cloud -> automation -> action -> Send web request

Request URL:  https://yoursite.atlassian.net/rest/api/3/field/customfieldID/context/contextID/option

Headers:

Authorization: ******

Accept: application/json

 

method: Post

web request body: Custom data

Custom data:

 

{
"options": [
{
"disabled": false,
"value": "new option value"
}
]
}

 

please refer to this link: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

Like 2 people like this
1 vote
Tina Xu November 24, 2022 edited

jira cloud -> automation -> action -> Send web request

Request URL:  https://yoursite.atlassian.net/rest/api/3/field/customfieldID/context/contextID/option

Headers:

Authorization: ******

Accept: application/json

 Method: Post

web request body: Custom data

Custom data:

 

{
"options": [
{
"disabled": false,
"value": "new option value"
}
]
}

 

please refer to below links: 

Send web request with Automation: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

JIRA Rest API:https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-customfieldoption-id-get

 

 

Jawann Swislow
Contributor
January 18, 2024

This is the way.

Suggest an answer

Log in or Sign up to answer