How do you add a column to "Issues in Epic" panel

joshO
Contributor
May 16, 2013

Hello Everyone,

I am not sure if this is possable but is there a way to add a new column to the Issues in Epic panel on epics. I am hoping there is some configuration setting somewhere like subtask.

Thank you in advance.

14 answers

1 accepted

4 votes
Answer accepted
Timothy
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.
May 16, 2013

Don't think this option is avaialble at the moment. Editing the add-on would be the only way now i think.

11 votes
Renjith Pillai
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.
November 16, 2013

Put this into announcement banner (remember the change the custom field id in the script):

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
	console.log('Found epic table');
	var row = this;
	var issueKey = AJS.$(this).attr("data-issuekey");
	AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
		console.log('Got data for - ' + issueKey);
		var value = data.fields.customfield_10600;
		console.log('Value - ' + value);
		var actions = AJS.$(row).find('td.issue_actions');
		AJS.$(actions).before('<td class="nav">' + value + '</td>');
	});
});

});
</script>

Ilya Fourmanov December 1, 2013

Thanks for sharing this Renjith!

I'm trying to add fixVersions value to the table and struggle to address this filed properly.

data.fields.fixVersions returns object type, how can I get version(s) names?

Renjith Pillai
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.
December 3, 2013

fixVersions is an Array. Use this:

<script type='text/javascript'>
AJS.$(document).ready(function() {
 
AJS.$('#ghx-issues-in-epic-table tr').each(function(){
    var row = this;
    var issueKey = AJS.$(this).attr("data-issuekey");
    AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
        var value = data.fields.fixVersions.map(function(version){return version.name});
        var actions = AJS.$(row).find('td.issue_actions');
        AJS.$(actions).before('<td class="nav">' + value + '</td>');
    });
});
 
});
</script>

Like # people like this
MattS
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.
December 3, 2013

That's very useful and a good example of how to change what is show. It will need testing for each version of Agile since the DOM model changes reasonably quickly between versions in my experience.

Robert Pepitone
Contributor
February 11, 2014

Renjith,

can you please provide the Announcement banner entry for adding timespent to the Issues in Epic display? I tried this and it's not working for me...

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);
var value = data.fields.timespent;
console.log('Value - ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});

});
</script>

Thanks

Renjith Pillai
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 19, 2014

That seems to be correct. Can you try to print the output of the REST call using the browser console and see the data format?

AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/&lt;your issue id&gt;', function(data){
console.log(data);
});

Robert Pepitone
Contributor
February 19, 2014

Renjith, I see what the problem is...Jira is displaying hours (in the Issues in Epic section) only for stories that have hours booked directly against the story. But Jira is not displaying hours that are booked against subtasks of those stories. Is there a way I can see hours booked against subtasks of Issues in Epics as well as hours booked directly against the stories?

Thanks

Renjith Pillai
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 20, 2014

Ahh, right. JIRA is designed that way.

You can, you need to extend the script a bit to do a query for all the sub-tasks of the parent.

For example, this gives the sub-tasks of the parent JRA-36686 - https://jira.atlassian.com/rest/api/2/search?jql=parent%20%3D%20%22JRA-36686%22

You need to write a function which checks this data and sums up all the values for the children.

Robert Pepitone
Contributor
February 20, 2014

Thanks Renjith, do you have an example of the function you mentioned above?

Renjith Pillai
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 20, 2014
var totalSpent = 0;
var issueKey = "CONF-21986";
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/search?jql=parent%20%3D%20%22' + issueKey + '%22', function (data) { for (var i = 0; i < data.issues.length; i++) { var subTime = data.issues[i].fields.timespent; if (subTime) { totalSpent += subTime; } console.log("Total time in seconds : " + totalSpent); } });

Raju Adluru
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.
April 3, 2014

Hi Renjith

I have a custom field - Target release(single drop down) with multiple values, when i put this code in banner, i am getting "object object" instead of target release value, am i missing anything here. can u help me with this.

Tried with fixversion code, thats working fine for fix versions displaying in "issue in epics" section.

thanks

Raj

Renjith Pillai
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.
April 4, 2014

Just try to do a console.log of the object and see the object properties and use the appropriate one. (might have a 'name' member)

Raju Adluru
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.
April 6, 2014

Renjith

thanks for quick response, appreciate your help.

I tried with name.customfield_xxxx, i am getting value as "undefined" instead of selected value.

Object properties as shown below.

<label for="customfield_11208">Target Release</label>

<select class="select cf-select" name="customfield_11208" id="customfield_11208">

<option value="-1">None</option>

<option value="11124">Release 1</option>

<option value="11125">Release 2</option>

<option value="11126">Release 3</option>

<option value="11127">Release 4</option>

<option selected="selected" value="11128">Release 5</option>

<option value="11129">Release 6</option>

<option value="11130">Release 7</option>

<option value="11131">Release 8</option>

<option value="11132">Release 9</option>

</select>

Renjith Pillai
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.
April 18, 2014

Raj, I meant the json object that you are getting (not the html data). I don't know what you meant by name.customfield_xxxx. Can you paste the json output for the issue? http://your_server_name:port//rest/api/latest/issue/your_issue_key

Kathryn Allison
Contributor
May 8, 2014

Hey Renjith,

How can we add Sprint name to the fixversion issue in epics column adjustment?

Renjith Pillai
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.
May 23, 2014

In fact Sprint is also a custom field. For example in the public instance, the customfield is customfield_11930. You may need to do some string parsing based on the value that you get for the customfield.

Kathryn Allison
Contributor
June 15, 2014

using the custom field value for Sprint gives the follwing result in the Epic columns: com.atlassian.greenhopper.service.sprint.Sprint@14a1cbbf[name=RNA 2014.1.0 Sprint 1,closed=true,startDate=2014-03-31T09:00:00.000-04:00,endDate=2014-05-02T17:00:00.000-04:00,completeDate=2014-05-16T10:54:12.107-04:00,id=179]

Kathryn Allison
Contributor
June 25, 2014

Any ideas on how to show just the name?

Srinivas Surabhi October 19, 2015

Renjith, You nailed it! Thank you much for sharing this!! Can you help me add headings to this panel? I am trying to add headings so for the new column that I added, most of the fields are null and users get confused by just seeing the 'null' values. Your help is much appreciated! Thank you.

RobertH
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.
October 22, 2015

Can we revisit this? I've managed to get the 'Due Date' setup to show. However, when you edit the issue from the gear/cog icon, that section of the page reloads and the data disappears. I've tried with both (document).ready() and (window).load with no success. Any help to rerun this when that event is run would be really helpful!

susan.walker June 2, 2016

Hi there.  This has been very helpful.  I successfully added story points and fix version.  But I can't seem to figure out how to parse the sprint to get the name.   When I use a javascript function like split(","), the entire script seems not to work.   Any help is appreciated.

Terry Beavers
Contributor
November 16, 2016

Just applied the FixVersion script.  Thank you, thank you, thank you @Renjith Pillai!

Hopefully Atlassian will resolve https://jira.atlassian.com/browse/JSW-14705, but being that it was submitted over 3 years ago, not holding my breath.

Ilze Schoeman
Contributor
October 23, 2018

Hi guys - sorry this will be a ridiculous question to those who know... 

How do you enter code like that into Jira? Does it have to be the server version of the software? Or is this possible on the cloud version?

Like # people like this
Deepali Bagul
Contributor
September 16, 2019

Hi Guys,

I am looking for adding priority column for the issues in epic. @Renjith Pillai can you help me out the JS script for jira server (v 8.0.x)

Thanks in advance.

Regards,

Deepali Bagul

Dan27
Contributor
January 4, 2021

Hello ,

There is an option to do the same for issue links? (is Feature of Epic)?

Oskar Austegard
Contributor
July 26, 2022

For the priority simply replace the custom field with priority.name

i.e. replace 

  var value = data.fields.customfield_10600;

with

  var value = data.fields.priority.name;
Daniel Hong September 29, 2023

If this is no longer working for anyone, it may be because AJS is not accessible. You may want to try delaying the code execution.

document.addEventListener('DOMContentLoaded', function(event) {

... code here ...

});
6 votes
Terry Welliver
Contributor
August 22, 2016

It would be nice to be able to configure Issues in Epic like sub-tasks.

4 votes
Aleksei Klimkin
Contributor
December 14, 2018

Why isn't this available in the advanced settings as for sub-tasks?

In our Jira the announcement banner is used for other purposes and putting a js script that certainly not all admins would understand is a really bad practice as from my perspective.

Can the same thing be done in some add-ons? Maybe Behaviours?

Jerome Bleichenbacher
Contributor
December 17, 2018

I totally agree.

Adding a script to the annoucementbanner cannt be the solution as you have to potentially develop, test and fix it after every update.

 

So there really is no "clean" solution?

Like Aleksei Klimkin likes this
1 vote
Deepali Bagul
Contributor
May 5, 2020

cc: @RenjithA 

I am posting answer for priority name for issues in epics. Use below code in announcement banner

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
var value = data.fields.priority.name;
console.log('Got priority column value:- ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});

});
</script>

 Thanks.

Heather R
Contributor
May 7, 2020

Hm, this script isn't giving me the priority icon. Is this possibly due to me being on server?

Deepali Bagul
Contributor
May 7, 2020

Hi @Heather R 

Below code should work and will give the priority name. The icon somehow is not working for me now , i am also on server

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
var value = data.fields.priority.name;
console.log('Got priority column value:- ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});

});
</script>
Like # people like this
Heather R
Contributor
May 7, 2020

@Deepali Bagul That is so helpful!! Thank you! I'm getting the text of the priority. You wouldn't happen to know how to tweak this to get the priority icon, would you?

Heather R
Contributor
May 7, 2020

Silly me, I see that you said the icon is somehow not working right now.

Deepali Bagul
Contributor
May 7, 2020

Yes, i couldn't get the icon working :(

Daniel Hong
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 27, 2021

We are using Server v7.12.1

I was able to display the icons with this:

<script type='text/javascript'>
AJS.$(document).ready(function() {
AJS.$('#ghx-issues-in-epic-table tr').each(function(){
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
var priorityIconUrl = data.fields.priority.iconUrl;
var actions = AJS.$(row).find('td.status');
AJS.$(actions).before('<td class="nav priority"><img src=' + priorityIconUrl + '></td>');
});
});

});
</script>

 I also switch the position to be next to the issuetype icon.

Like Oskar Austegard likes this
0 votes
Omar Rashid February 6, 2024

@Renjith Pillai The code doesn't work on Jira 9.12.2 - Any way to make it work for issues in epics for that version? I was trying with a story points custom field 

&lt;script type='text/javascript'&gt;
AJS.$(document).ready(function() {
AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);
var value = data.fields.customfield_10117;
console.log('Value - ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('&lt;td class="nav"&gt;' + value + '&lt;/td&gt;');
});
});
});
&lt;/script&gt;
0 votes
SKAdmin
Contributor
August 16, 2023

I see this is an older thread, but I'm having the same issue. We need to display fix version in the Epic Link and Issue Link section. Neither of these are working. Any suggestions would be greatly appreciated. 

 

Add Fix Version to Epic Link Section
<script type='text/javascript'>
AJS.$(document).ready(function() 
{
AJS.$('#ghx-issues-in-epic-table tr').each(function()
{
    var row = this;
    var issueKey = AJS.$(this).attr("data-issuekey");
    AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data)
{
        var value = data.fields.fixVersions.map(function(version){return version.name});
        var actions = AJS.$(row).find('td.status');
        AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
}); 
});
</script>
Add Fix Version to Issue Link Section
<script type='text/javascript'> 
AJS.$(document).ready(function() 
{
AJS.$('dl.links-list dd').each(function()
{
var row = this; 
var objIssueLink = AJS.$(row).find('a');
var linkedIssueKey = "";
linkedIssueKey = AJS.$(objIssueLink).attr("data-issue-key"); 
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + linkedIssueKey, function(data) 
{
var value = data.fields.fixVersions.map(function(version){return version.name});
var action = AJS.$(row).find('span.link-summary');
AJS.$(action).after('<span><b> (' + value + ') </b></span>');
});
});
}); 
</script>
0 votes
Dang Thi Thuy Tien
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.
July 5, 2020
0 votes
Marco_Struck
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 3, 2020

Hello everybody,

It was important to me to show the sprints in the epic as well as the versions.

The key is to call up the correct REST endpoint.

Here is the corresponding code:

<script type='text/javascript'> // https://community.atlassian.com/t5/Jira-questions/How-do-you-add-a-column-to-quot-Issues-in-Epic-quot-panel/qaq-p/292561 AJS.$(document).ready(function() { AJS.$('#ghx-issues-in-epic-table tr').each(function(){ var row = this; var issueKey = AJS.$(this).attr("data-issuekey"); AJS.$.getJSON(AJS.contextPath() + '/rest/agile/1.0/issue/' + issueKey, function(data){ //console.log(data); var actions = AJS.$(row).find('td.issue_actions'); sprintinfo = "" if (data.fields) { if (data.fields.sprint) { sprintinfo = "<b>" + data.fields.sprint.name + "</b><br/>" } if (data.fields.closedSprints && Array.isArray(data.fields.closedSprints)) { sprintinfo = sprintinfo + "<i>" for (i = 0; i < data.fields.closedSprints.length; i++) { if (i > 0 ) sprintinfo = sprintinfo + "<br/>" sprintinfo = sprintinfo + data.fields.closedSprints[i].name } sprintinfo = sprintinfo + "</i>" } } AJS.$(actions).before('<td class="nav">' + sprintinfo + '</td>'); var version = data.fields.fixVersions.map(function(version){return version.name}); AJS.$(actions).before('<td class="nav">' + version + '</td>'); }); }); }); </script>

 

Best,
Marco
 

sandeep4774 March 25, 2020

Folks, Here is my simple script to display latest sprint in Issues in Epic panel. You need a custom field id for latest sprint.

 

<!-- Script to add latest Sprint column in Issues in Epic panel -->
<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);
var value = "" ;
if (data.fields.customfield_25380 != null) {
value = String(data.fields.customfield_25380)};
console.log('Value - ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});
});
</script>

 

0 votes
Tobias Albrecht July 7, 2017

Hi,

I found a very good input here for my issues here. But while getting into the more into the details for my solution one question regarding issuetype arose:

I would like to check in such a script the type of issuetype to proceed with different actions depending on the issuetype. But somehow I don't get back the issuetype. Here's my script:

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;

var issueKey = AJS.$(this).attr("data-issuekey");
string1 =issueKey + " ";

if (string1.startsWith("PSUMBRELLA")) {
    


AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);

var value1 = '- ' + data.fields.components.map(function(component){return component.name})+ ' -';
var value2 = data.fields.fixVersions.map(function(fixVersion){return fixVersion.name})+ ' - ';
var value3 = 'RemainingEffort: ' + (data.fields.aggregatetimeestimate)/3600 + 'h - ';
var value4 = 'IssueType: ' + (data.fields.issueType.name))+ ' - ';


console.log('Value - ' + value1 );
console.log('Value - ' + value2 );
console.log('Value - ' + value3 );
console.log('Value - ' + value4 );

var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<font color="red"><td class="nav">' + value1 + '</td></font>');
AJS.$(actions).before('<td class="nav">' + value2 + value3 + value4 +'</td>');
});
}
});

});

</script>

 

Marked the area which I am struggling with in bold letters.

thanks for feedback

Best regards

Tobias

0 votes
Tom Pfueller February 6, 2017

This javascript snippet helped us too, because we wanted to see sprint data on this table.

However extracting sprint name is not easy as some already mentioned.

So I decided to solve this via string manipulation after converting "data.fields.customfield_10004" to a string.

My code is as follows:

&lt;script type='text/javascript'&gt;
AJS.$(document).ready(function() {
AJS.$('#ghx-issues-in-epic-table tr').each(function(){
    console.log('Found epic table');
    var row = this;
    var issueKey = AJS.$(this).attr("data-issuekey");
    AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
        console.log('Got data for - ' + issueKey);
        var value = "No Sprint" ; 
        if (data.fields.customfield_10004 != null) {
                   value = String(data.fields.customfield_10004);
                   var re = /name/;
                   var pos = value.search(re);
                   value = value.substring(pos);
            
                   var re2 = /,/;
                   var pos2 = value.search(re2);
                   value = value.substring(5,pos2);
                   }
        console.log('Value - ' + value);
        var actions = AJS.$(row).find('td.issue_actions');
        AJS.$(actions).before('&lt;td class="nav"&gt;' + value + '&lt;/td&gt;');
    });
});
});
&lt;/script&gt;

Hope that helps.

Tobias Albrecht July 6, 2017

 

 

Andrii_Movchan February 7, 2019

Hi

Do you know how to replace there column "Stage" to "Sprint". Because sprint number is more useful?

https://take.ms/4rnrt

Marco_Struck
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 3, 2020

See my last post

0 votes
Lukasz Baksik June 3, 2016

Hi Renjith,

I added a cloumn do display labels. Is there any way to move the column position from last to third (after issue key and summary)?

Thanks,
Lukasz 

Henrik Gerdtsson
Contributor
December 21, 2018

Hello Lukasz,

The insertion is done with the line

AJS.$(actions).before('<td class="nav value">' + value + '</td>');

The line before that set the action

var actions = ALS.$(row).find('td.issue_actions');

Looking at the web page in the developer console, F12, you will see that td.issue_actions is the last table data column. Replacing td.issue_actions with the appropriate column will change the position. E.g. use td.issutype to place it between the summary and the issuetype icon.

var actions = ALS.$(row).find('td.issuetype');
AJS.$(actions).before('<td class="nav value">' + value + '</td>');

Br
Henrik

0 votes
elizabethhannaford August 26, 2015

Hi - Can someone tell me exactly where I enter these details


Thanks

Lukasz Baksik June 3, 2016

Administration > System > User Interface > Announcement Banner - it has to stay there as long as you want to add extra column/s.

Ghazanfar February 26, 2018

Lukasz Baksik I don't see "ANNOUNCEMENT BANNER" in Jira Cloud.

User Interface is present in System but even if i search for the word Banner or Announcement, nothing turns up. I have gone through the menus many times, nowhere can I fin Announcement Banner in Jira Cloud.

 

Can you please clarify?

 

Kind Regards.

Like # people like this
0 votes
metropolitanit
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2014

Hi Renjith

How do you add multiple custom fields as columns in "Issues in Epic" panel?

Is it:
var value = data.fields.customfield_10600, data.fields.customfield_10601;

Many thanks.

Azi Gabbay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 28, 2016

The best approach is to loop over the fields.

console.log('Got data for - ' + issueKey);
                                
        var actions = AJS.$(row).find('td.issue_actions');
        
        var index;
        var fields = [data.fields.customfield_10600, data.fields.customfield_10601,data.fields.customfield_10602];
        var addToTable = "";
        
        for (index = 0; index &lt; fields.length; ++index) {
            var field = fields[index];
            if (!field) {
                field = "";
            }
            addToTable += '&lt;td class="nav" style="white-space: nowrap"&gt;' + field + '&lt;/td&gt;';            
        }
                
        AJS.$(actions).before(addToTable);
Scott McDonald
Contributor
August 8, 2016

Why doesn't all me to 'set banner'?

 

Scott McDonald
Contributor
September 12, 2016

Can you configure this to only display the issues in a specific project and not all epics?

 

Like Deleted user likes this
Manjunatha K R
Contributor
October 27, 2016

Hi Renjith,

I tried to add "Due Date" and "Component", 2 columns into "Issues in Epic" as follows. But it's displaying as undefined - why it's so? anything wrong in the script...

 

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);
var value = data.fields.Due;
console.log('Value - ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});

});
</script>

 

Manjunatha K R
Contributor
October 27, 2016

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);
var value = data.fields.Components;
console.log('Value - ' + value);
var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value + '</td>');
});
});

});
</script>

Kurt Mueller
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 8, 2016

I have the results that I expect the first time that I set the banner, and go to an epic. But when I go to another epic, I don't get the new columns that I've added unless I click on Reload page.  Any ideas how to fix that issue?

Manjunatha K R
Contributor
November 20, 2016

Hi,

I tried to add multiple custom fields(components, duedate) as columns in "Issues in Epic" panel as below and it's working successfully now for me - you can try to follow the same as per your requirement.

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
console.log('Found epic table');
var row = this;
var issueKey = AJS.$(this).attr("data-issuekey");
AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
console.log('Got data for - ' + issueKey);

var value1 = data.fields.components.map(function(component){return component.name});
var value2 = data.fields.duedate;

console.log('Value - ' + value1);
console.log('Value - ' + value2);

var actions = AJS.$(row).find('td.issue_actions');
AJS.$(actions).before('<td class="nav">' + value1 + '</td>');
AJS.$(actions).before('<td class="nav">' + value2 + '</td>');
});
});

});
</script>

Like desarrollo likes this

Suggest an answer

Log in or Sign up to answer