Can XPorter Plugin be leveraged to create a PDF on transition of an issue?

I need to generate a PDF file of an issue and store it on the file system when the issue is closed. I would like this to happen automatically through groovy script or some other means. Can I leverage XPorter to generate the PDF?

2 answers

1 accepted

Hi Nancy,

Maybe you can directly call the Xporter for JIRA servlet which generates the PDF Document. An example of such request is:

http://jirahost:8080/plugins/servlet/jiraxporter?issueKey=ELECTRIC-3&outputType=pdf&template=Sample.docx

Just replace issueKey and template parameter values with the ones that you need.

Also, please certify that you are performing this request on behalf of a user that has the correct permissions to use the plugin.

Best Regards

I have coded this:

def issueKey = issue.getKey()

def String urlString = "http://webcat4.mutualofomaha.com/jira/plugins/servlet/jiraxporter?issueKey=$issueKey&outputType=pdf&template=Sample.docx"

def file = new FileOutputStream(urlString.tokenize("/")[-1])

new File(urlString.tokenize("/")[-1]).withOutputStream { out ->
    def url = new URL(urlString).openConnection()
    def remoteAuth = "Basic " + "req83168:Lhm4756a".getBytes().encodeBase64()
    url.setRequestProperty("Authorization", remoteAuth.toString());
    out << url.getInputStream()
}

And get a really strange error:

/plugins/servlet/jiraxporter [commons.jira.kconfig.PluginConfiguration] Database JNDI >>TestDB<< is not defined
/plugins/servlet/jiraxporter [databasecf.querydb.impl.QueryDatabaseImpl] Not connected. Possible database misconfiguration ?
1 /plugins/servlet/jiraxporter [databasecf.querydb.impl.QueryDatabaseImpl] Could not execute SQL query >>select filename from avatar<< on database TestDB.
java.sql.SQLException: Not connected. Possible database misconfiguration ?

I am calling the Groovy script from a transition in JIRA, the script should be getting the PDF of the issue and saving it to filesystem. Is there another way that I should be connecting?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

182 views 0 4
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