Database Values custom field custom field accessible from xporter templates?


I am using the Database Values plugin to import tabular data into JIRA issues. For instance, data about a 'Client' associated with an issue:


I'd now like to use Xporter to generate PDFs incorporating this client info.

The getCustomFieldValue() output of this custom field is actually an java.util.ArrayList, where each value is an ArrayList containing two Strings, a key and a value. In pseudocode:

Client Info = [
    ["Client name (legal)", "Sample Client Inc."],
    ["Client name (short)", "sampleclient"],
    ["Technical Contact First Name", "Joe"],
    ["Technical Contact Last Name", "Bloggs"],

Is it possible to access the values of such a custom field structure in Xporter templates? I've tried ${Client Info.Client name (legal)} but that doesn't work.




6 answers

1 accepted

2 votes
Answer accepted

Hi @Fábio Antunes,

Thanks for the pointer, I figured out a solution. I wrote a Groovy scripted field that exposes the table's data as a Javascript. The Groovy script is:

// Groovy scripted field to expose a Database Value custom field (tabular data)
// as a Javascript hash.
import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonOutput
cf = ComponentAccessor.customFieldManager.getCustomFieldObject(10502) // Client Info
cfVal = issue.getCustomFieldValue(cf)
valMap = cfVal.inject([:]) { result, item -> result[item[0]] = item[1]; result; }
return JsonOutput.toJson(valMap)

This returns text of the form:

{"TITLE":"VAL", "Client name (legal)":Sample Client Inc.", ....}

Since my Database Values field is called Client Info, I named this scripted field Client Info JSON. Then in my xporter template, I use it with:

Hello %{ var
info = ${Client Info JSON}; info[“Billing
Contact First Name”]},



Hi @Jeff Turner


Currently Xporter for JIRA does not support Database Values plugin and for that reason it is not possible to access the values that way. The workaround is use javascript to get the data from the value returned by the custom field.

Could you perform an export of that custom field and paste here the generated value to the exported file ?

Kind Regards,
Fábio Antunes 

Hi Jeff Turner


Yes, in order to help you select the pretended data.

Kind Regards,
Fábio Antunes 

Hi Jeff Turner,


Great Solution, glad to know that everything is working as expected. 

Kind Regards,
Fábio Antunes 

Hi Fábio,

Thanks for the help. When you say generate an "export", do you mean the text that ${Client Info} expands to? With the idea being that the text can be parsed with Javascript?


I use also xporter and crm for JIRA. When i export the custom dictionary - custom field it gives me the dictionary field id number (not the value, fo example not the user name just that id number).

Does anyone have idea?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


246 views 0 6
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you