Auto Populate Jira Custom Field Based on Values in Another Custom Field

Kay Brown
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, 2014

I have a custom field called Client Name. I would like to auto-populate another custom field called Client Code based on the value in the Client Name field. Is there a way to build a database table containing client codes?

Thanks,

Kay

5 answers

1 vote
Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2014

Hi, Kay. When do you want to set this value? On creating the issue?

If it is the case, you can do it with post functions and the JIRA Suite Utilities plugin, here:

About post functions: https://confluence.atlassian.com/display/AOD/Advanced+workflow+configuration#Advancedworkflowconfiguration-postfunctions

JIRA Suite Utilities: https://marketplace.atlassian.com/plugins/com.googlecode.jira-suite-utilities

Simply install the plugin and then, when creating a post function, you will have the "Copy value from other field" option. You can use this on the 'Create' transition, to copy on creation, or on any other transition.

If you want to set the field on already created issues, you will probably need to use SQL on the database. This is something more advanced.

I hope it was helpful.

Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2014

That is much more advanced.

Where is the data mapping code and name, in a database?

Kay Brown
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.
September 9, 2014

Hi Jaime, Yes, the information is in a database. Regards, Kay

Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2014

I advise you to look for a plugin in the Marketplace: https://marketplace.atlassian.com/. There may be one that helps you with that. Cheers.

Kay Brown
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.
September 10, 2014

Thank you, Jaime! Regards, Kay

0 votes
himanshuagrawal7689 August 6, 2019

I achieved this by hiding the standard EDIT button from the screen and adding a loop(a transition step - EDIT) on each status with Screen - Edit/View Issue and in the post functions I wrote my logic. 

if Field1 != Null then do Field2 = "Yes" else Field2 = "No".

 

NOTE - 

1. This is not the prettiest way to achieve this.

2. Please make sure you allow anyone to execute this particular transition otherwise the EDIT button will be hidden and will only be available based on the condition you have defined.  

0 votes
Sarath May 4, 2018

How to implement using the script runner plugin? should we make use of script fields?  @Thanos Batagiannis _Adaptavist_ - happy to know if you have any inputs on this? 

Sneha Crews May 23, 2018

I think you may want to look at ScriptRunner behaviors - https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html#_dynamically_changing_the_picker_query

That may help you

0 votes
Nanda May 17, 2017

Hi All, I too have a similar requirement to auto populate a drop down with list of values based on another dorp down custom filed.

If the first filed value is EI, then the second drop down should list all the EI defect types like CR & PR. And if the first filed value is PD, then the subsequet dorn down should list only the PD defect types.

Please let me know, how to achive this in JIRA ?

CLINTON E. SMITH October 24, 2017

Nanda,

Did you ever get an answer to this? I was able to do this with drop-down selection lists.  I have yet to be able to do this for the case outlined by the OP, but this one I have an answer for if you still need it.

Regards,

Clint

Eric_Mertens November 3, 2017

And the answer is..... ? :-)

Sakshi Mittal March 26, 2018

Hi Clint,

I have a smiliar requirement. Could you please share the solution?

 

Regards

Prashant Hubballi June 5, 2018

Hi Nanda,
Did you get solution for this ? we too have similar requirement. Any help is appreciated. 

Thank you  

ISS_Administrator June 14, 2018

I am also looking for a solution to this...

Sriram Madhavan August 13, 2018

Create a Custom field "Select List(Cascading)"

0 votes
Kay Brown
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.
September 10, 2014

Hi Jaime,

I want the Client Code value to auto-populate when data is entered into the Client Name field. The Client Code is unique for each client. The Client Code would not be an existing value, it would be a new value that does not exist in the ticket.

Thank you,

Kay

Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2014

Hi, Kay. I'm not sure exactly how, but I think you can accomplish that with post functions: https://confluence.atlassian.com/display/AOD/Advanced+workflow+configuration. Give it a look and see the ones available. Cheers!

Like Deleted user likes this
Rosy Salameh February 21, 2017

Hi @Kay Brown, @Jaime Silveira

I have the same requirement. Will you be able to achieve that?

 

thanks,

Rosy

Jaime S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2017

Well, in general you can only set fields automatically on transitions. So, if you want to do this during a transition, there are post-functions that allow you to copy values from a field to another. I'm not sure if an add-on won't be necessary, depending on the situation and the environment, you should check the available post-functions.

Otherwise, you can give 'ScriptRunner' a try. It may also help in this case.

You can read about post-functions here:

https://confluence.atlassian.com/adminjiracloud/advanced-workflow-configuration-776636620.html

Like Deleted user likes this
Rosy Salameh February 22, 2017

thanks Jaime! however, I wanted to do that independently from the transition, it should be triggered each time I populate the value of the field. Should I use event listeners to do that for the change of the issue?

 

thanks,

rosy

Kay Brown
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 22, 2017

Hi Rosy,

No, I was not successful in achieving this goal.

Regards,

Kay

Suggest an answer

Log in or Sign up to answer