It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confluence Jira Issue Macro does not display custom fields!

Hello,

I am evaluating confluence and jira integration. I am unable to get the jira issue macro display the custom fields! I have one field "I Promised I Will FLT On" which is on free text type and another one "Project Name" of text type 9255 charcters) which are available on issues which I want to get on the issue macro. I can see from the filter xml that the fields do exists on the filter URL used by issue macro but I just can't understand where I am doing somethig wrong!

Screen prints attached for your review. Appeciate your quick help. Thanks!

<customfield id="customfield_10610" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
<customfieldname>I Promised I Will FLT On (4)</customfieldname>

<customfieldvalues>
<customfieldvalue>&nbsp;</customfieldvalue>
</customfieldvalues>
</customfield>

<customfield id="customfield_10202" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
<customfieldname>Project Name</customfieldname>

<customfieldvalues>
<customfieldvalue>Hima Bindu</customfieldvalue>
</customfieldvalues>
</customfield>

3 answers

1 accepted

5 votes
Answer accepted

Don't have a direct answer to display the custom field in jiraissues macro. But you can add the "Filter Results" portlet of Jira directly to Confluence (refer http://confluence.atlassian.com/display/DOC/External+Gadgets), and there you can select whatever you want to display (the same way you would have done on a Jira Dashboard).

Does this help?

Renjith, you just made my day! It's an excellent workaround.

Why workaround? Because the downside is: it does not create a "clickable" JIRA items list compared to the "JIRA issue gadget".

Again, thanks!

-AM-

Its been a while since this question has been asked but I was myself confronted with the same problem very recently. Custom field data just did not appear for the JIRA issue macro in Confluence. 

After a lot of experiments and RTM, I found the solution. The custom fields needs to have a xml velocity template included in the field definition. 

&lt;resource type="velocity" name="xml" location="/templates/heat-map-riskstatus-cfield/xml-color.vm"/&gt;

The sample for this velocity template is 

#disable_html_escaping()
#if($renderedValue)
&lt;customfieldvalue&gt;$xmlutils.escape($renderedValue)&lt;/customfieldvalue&gt;
#elseif ($value)
&lt;customfieldvalue&gt;$value&lt;/customfieldvalue&gt;
#end

HTH

 

It worked! You're a genius! You have made me to avoid a huge waste of time.

Like White_Linen_Homes likes this

Could you please share details on how you were able to get the custom field data to show in the Confluence macro? I am still not having any luck... Kind regards.

Could you give detailed step by step guide how to do this. We have a requirements doc, with then want create a new epic or story and need a custom field in that macro dialogue.

 

Thanks

Hi Gaurav, 

It would be great if you can explain the solution in detail. I am stuck with Jira issue macro not rendering the custom fields. Thanks in advance. My email id asnmurthy@gmail.com

 

Please help.

Superb! Thanks for the solution.

Can someone provide some details in how this is done?  

How do the access the field definitions for the custom fields to add the xml velocity template?

Any and all help is greatly appreciated.

TIA!!

As Confluence apparently uses the XML output of JIRA to display issue tables in its macros, you need to be able to show your custom field in XML. You can view what the issue's XML is by opening the issue, hitting the Export button on the top right and selecting XML from there (or just navitating to the XML url: YOUR_JIRA_URL/si/jira.issueviews:issue-xml/ABC-123/ABC-123.xml).

The end goal is for your custom field to show up in this XML.

The way to achieve it is, as Gaurav described, to add a Velocity template corresponding to the XML output to your atlassian-plugin.xml file:

<customfield-type name="Your Field" class="com.class.path.to.YourField" ...>
<resource name="view" location="/templates/customfields/your-field/view.vm" type="velocity" />
<resource name="xml" location="/templates/customfields/your-field/xml.vm" type="velocity" />
</customfield-type>

Where xml.vm looks very similar to your view.vm and can be as simple as:

#disable_html_escaping()
#if($value)
<customfieldvalue>$value</customfieldvalue>
#end

The latter can vary depending on how your HTML template ("view" resource) looks like. The XML tempalte has to output valid XML (duh) :)

Like # people like this

Hey guys,

Not sure if you can help me here or direct to another issue, but I need to be able to assign a JIRA issue that i'm creating from the Confluence page.

Right now there is no option to assign an issue to anybody, it is automatically assigned to project lead, this means I have to go to JIRA afterwards and manually assign to the correct person in JIRA. Just seems very inconvenient.

Thanks
Janis

 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

382 views 11 11
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you