How to copy Advance Roadmaps Team field value to another custom field ?
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
In this article we are going to discuss how we can copy Advanced Roadmap's Team field value to another Text field.
Environment
Jira 8.x and later
Diagnosis
Problems:
- If a user try to implement this using external plugins is, copying Team field's value to a custom-field might return id of Team field instead of actual value.
- If the same scenario is tried with Rest API, json output gives Id instead of actual field value. For example:
If we check response of this REST operation, we would find field like "customfield_10111":"33" in REST response for Team field. Here we only get id but not value.
/rest/api/2/issue/[issue-id]?fields
There is a separate REST API for Advance Roadmap Team Management REST APIs, the Advance Roadmap Live Plans REST APIs or the Roadmap Java API. There is an article as well. We could test one of the Roadmap REST operation following way :
$ curl -u "username:password" http://localhost:8080/rest/teams-api/1.0/team
[{"title":"Mobile Apps Team","shareable":true,"id":33}]%
Solution
Solution 1
It is possible to copy Team field value, for that the following javascript could be helpful. You might need more modifications as per script. Here customfield_10111 represents Team field's id and customfield_10300 is the custom field where we want to copy value. In Description of target customfield, we would have to provide this javascript snippet.
<script type="text/javascript">
teamTitle = document.getElementById('customfield_10111-val').children[1].innerText;
target = document.getElementById('customfield_10300-val').innerText ;
if(teamTitle) {
document.getElementById('customfield_10300-val').innerText=teamTitle;
}
</script>
Solution 2
User can check for external plugins and write a script to get the value of Team field. For example user can use Adaptavists Scriptrunner plugin to copy the value of Team field.