Forums

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

Autofill "Issue Type" using the "custom field" value

Lakshmi CH
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.
June 19, 2023

Hi Team,

Our team needs assistance automatically populating the "Issue Type" field with the value from a "custom field." Can this be achieved using Script Runner, JMWE, and JSU add-ons?

2 answers

0 votes
imadero June 21, 2023

Hi @Lakshmi CH.

Yes, it is possible to do it using Scriptrunner.

At first, you need to configure a behaviour that executes when you update the custom field.

Inside the behaviour, you can use the following lines to make your script works:

import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE

// Get all the issue types available
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

//Get the issue Type Field
def issueTypeField = getFieldById(IssueFieldConstants.ISSUE_TYPE)


//You need to obtain the value of the custom field, and find the correct
//Issue type that you want to add

//Update the Issue Type value.
issueTypeField.setFieldOptions(<your variable with the proper issue type>)
I hope this helps you to start! But as you can see is not a complete solution, you need to add few things, but I can guide you for other questions that you have.
Thanks, Ivan.
0 votes
John Funk
Community Champion
June 20, 2023

Hi Lakshmi - I believe this will only be possible using the ScriptRunner Behaviours app. 

Lakshmi CH
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.
June 20, 2023

Hi @John Funk

Do you happen to have any sample code available?

John Funk
Community Champion
June 20, 2023

Sorry I don't as I don't actually use the tool. 

Suggest an answer

Log in or Sign up to answer