how do I make Epic Name appear in Confluence?
Asked by Jacques:

*This question is in reference to Atlassian Documentation: [JIRA Issues Macro](https://confluence.atlassian.com/pages/viewpage.action?pageId=139380)*

Hello,

I'm trying to reproduce some sort of User Story Map with the JIRA issues Macro in Confluence. One of the columns I would to see is the Epic Name. Nevertheless, when selecting this column it shows up completely empty. All my Stories are linked to an epic, but this doesn't show in Confluence.

When I add the Epic-Link column, it does show the key of JIRA Epics:

image2016-3-17 8:25:33.png

Does anyone have a solution?

I'm using Confluence version 5.9.4

Thanks!

[](https://community.atlassian.com/t5/Confluence-questions/how-do-I-make-Epic-Name-appear-in-Confluence/qaq-p/446506?attachment-id=9578){#link_11872c2c0758bf}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/75583/1/image2016-3-17%208%3A25%3A33.png){#display_11872c2c0758bf_0}  
[](https://community.atlassian.com/t5/Confluence-questions/how-do-I-make-Epic-Name-appear-in-Confluence/qaq-p/446506?attachment-id=9579){#link_11872c2c0758bf_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/75583/2/epicnamecustomfield.groovy){#display_11872c2c0758bf_2}


Answers:
author: Steven F Behnke
body: I was able to accomplish this as a little pet project.

**Final result --**

image2016-3-17 22:13:34.png

**Script Field --**

```
import com.atlassian.jira.component.ComponentAccessor;import com.atlassian.jira.ComponentManager;import com.atlassian.jira.issue.fields.CustomField;import com.atlassian.jira.issue.CustomFieldManager;import groovy.xml.MarkupBuilder;	def linkedEpic = getCustomFieldValue("Epic Link");	if (linkedEpic != null) {	CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();	CustomField epicNameField = customFieldManager.getCustomFieldObjectByName("Epic Name");	CustomField epicTagField = customFieldManager.getCustomFieldObjectByName("Epic Colour");		def colorValuesMap = ["ghx-label-1":"#815b3a", "ghx-label-2":"#f79132", "ghx-label-3":"#d39d3f", "ghx-label-4":"#3b80c4", "ghx-label-5":"#4a6785", "ghx-label-6":"#8fb021", "ghx-label-7":"#ac707a", "ghx-label-8":"#644982", "ghx-label-9":"#f15c75"];		def epicTag = linkedEpic.getCustomFieldValue(epicTagField);	def epicColor = colorValuesMap.get(epicTag);	def epicName = linkedEpic.getCustomFieldValue(epicNameField);	def epicKey = linkedEpic.key;		def writer = new StringWriter();	def xml = new MarkupBuilder(writer);	def baseUrl = ComponentManager.getInstance().getApplicationProperties().getString("jira.baseurl")		xml.a("href":"${baseUrl}/browse/${epicKey}", "class":"aui-label ${epicTag}", "style":"color: #fff; background-color: ${epicColor}; border-color: ${epicColor}", epicName)		return writer.toString();} else {	return null;}
```

:warning: Be sure to set the template to expect **HTML OUTPUT!**  
[](https://community.atlassian.com/t5/Confluence-questions/how-do-I-make-Epic-Name-appear-in-Confluence/qaq-p/446506?attachment-id=4414){#link_11872c32a93a29}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/75587/1/image2016-3-17%2022%3A13%3A34.png){#display_11872c32a93a29_0}

comments: author: Jacques
body: Thanks!

I tried this and get errors at line

* 16 and 18: \[Static type checking\]: cannot find matching method
* 19: no such property
* 23: \[Static type checking\]: cannot find matching method

When I try and run the script, I get the following error:

java.lang.NullPointerException

Any Solution to this?


author: Steven F Behnke
body: I am running JIRA 6.4.3 and a slightly older version of Script Runner. Perhaps there's differences between our versions? I could test on your version at a later point in time but not tonight. What are your versions of JIRA and Script Runner?

For me copying it here from confluence isn't working. The whitespace is garbage and scriptrunner is rejecting it. Perhaps remove all whitespace? ![cheeky](/html/@FAF1B8ED81FE63CF2DF635B2383CF9FB/images/emoticons/cheeky.png "cheeky")

I've attached a text file here instead --


author: Steven F Behnke
body: There is an in-progress suggestion for this here -- <https://jira.atlassian.com/browse/CONF-31534>

If you have ScriptRunner for JIRA, someone has posted a potential workaround concept.

comments: author: Jacques
body: Thanks Steven. The work-around sounds good, but there's no actual script attached so difficult to implement.


author: Steven F Behnke
body: Well, that's because work isn't free. ![cheeky](/html/@FAF1B8ED81FE63CF2DF635B2383CF9FB/images/emoticons/cheeky.png "cheeky")


Tags: jira