Forums

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

How can you add values to a custom field programmatically?

Adam Long February 13, 2024

I'm looking to programmatically add values to a customfield that is a select list (single) and I don't see an API in Jira Software Data Center that allows that like there is in Jira Cloud. Is it possible to add the value to the customfieldoption table directly? 

Use case: In a multi-tenant environment, clients register themselves as a program of record within the system using Jira Servicer Management. All follow-on tickets for this program can then pick their program from the list of values in the Program of Record field.

Intent: There is no human in the loop required as the requests are handled by Jira Automations which invokes a web hook to our Jenkins.  Jenkins takes all the necessary steps to onboard a program. This is where I'd like to update the customfieldoption.

I see, Database – Custom fields (atlassian.com), that there is an ID field that looks to be a sequence number, but it it's not clear if this is an autoincrement field or if there is a separate sequence table I have to retrieve a sequence number from.

...or perhaps there is a better way?

1 answer

1 accepted

0 votes
Answer accepted
Marc - Devoteam
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.
February 13, 2024

Hi @Adam Long 

Welcome to the community.

This can't be done in Server/DC

There is an open feature request for this you can vote for, see JRASERVER-36112 

Adam Long February 13, 2024

Thanks for the response...

Have you tried to do it through the database directly? I understand the REST API is not available as I mentioned in my original post.  The request you mentioned has been open for over 10 years, which gives me little hope that it will be worked. 

At the end of the day, any REST API is going to facilitate updating those tables. Perhaps there is more to these tables that makes it tricky?

Like Marc - Devoteam likes this
Marc - Devoteam
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.
February 13, 2024

Hi @Adam Long 

No I didn't, I would't do this via the DB directly as well.

This could cause DB issues and could bring your instance down. I would say make a db backup before, but you will still lose updates on issues done in the period you make the change and if it will fail.

You could have a dev instance setup to try it on, but best practice under Admins is DON"T MESS WITH THE DB DIRECTLY

You could switch to Cloud, as the API there has the option and server is EOL in 2 days.

Like Adam Long likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events