Copy custom field value of one issue type to all other issue type of that project

NT March 20, 2018

I want to copy custom field value of one issue type to all other issues of the project.

 

We have Issue type "Project info"  and we created one issue of "Project info" type per project to maintain all project related information.

So anything changes in the project we update the respective field on of  project info issuetype of that project.

Now I want to copy one of the custom field value of project info issue type to all other issue of that  project.

 

Can anybody help me with this?

 

2 answers

0 votes
Ali Türkkan August 15, 2021

Hi,

You can do this with the Field Teller Plugin available on the marketplace. The plugin's capabilities are to display the field on an Issue on another specified Issue.

You can Download it here: https://marketplace.atlassian.com/apps/1224310/field-teller?hosting=server&tab=overview

 

Best Regards.

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018

You need to write a  custom listener, which will be triggered everytime there is a change in the custom field value of the project info type and then traverse over all the issues  of the project and update them with the value coming from project info issueType.

An example here

https://community.atlassian.com/t5/Answers-Developer-Questions/Script-listener-for-changes-to-custom-field-runs-too-often/qaq-p/529425

NT March 20, 2018

Is it not possible through script runner plugin?

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018

The link which is shared with you is the example from script runner only.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018
NT March 20, 2018

Sorry for the confusion..

Just wanted to know if this can be possible through scripted field.

Can I created a scripted text field for all other issues types and copy custom field value of "Project info " issue type  to that scripted field.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018

Yes you can do that, in the scripted field you can fetch the custom field value from the issue of type "project info" and then return that value as a string. You can fetch the value either by hard-coding the issue key or using an JQL in the scripted field.

NT March 20, 2018

I have multiple projects  and I want it to be applicable on all the projects.

Can you help me with the sample code to fetch the value from one issue type and apply it to the same custom field of other issue type

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2018

You just need to have a scripted custom field and in it's context, map it to all the projects and then add the field to the "view screen" of all the issuetypes in the project's screen configuration scheme. Thus, everytime the issue loads the script on the scripted field will be executed and in the script you will be fetching the custom field value from the project info issuetype.

NT March 21, 2018

I have configured everything.. Only challenge I am facing here is to fetch the value from Project info issue type of each project.

 

See I have one "project info" issue per project and I am not able to fetch the value from "project info" issue type as I have to first fetch the project of current issue. 2) Then look for its project info issuetype and then fetch the value from it . 3) return its value.

If you can help me  with some sample code to copy the value of custom field from one issue into another then I can extend it to work for me

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2018

Just perform a JQL search within the scripted field. You can easliy create the proper jql since you have the issue object. From issue object you can fetch the project key and thus create a JQL string like

def projectKey = issue.projectObject.key

String jql = <below value>

project = $projectKey and type = "project info"

And this will return only 1 issue as you have only 1 project info per project and that one search result will be what you want.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2018
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 22, 2018

Hi @NT has the issue been resolved? If yes, please accept/upvote the answer. thanks.

NT March 22, 2018

Thank you for time and info..

 

Above link didn't help. But I implemented it using REST API..

Suggest an answer

Log in or Sign up to answer