Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create and attach a pdf file to a JIRA issue when issue is transitioned (JIRA Cloud)

Manish V
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!
December 4, 2023

Hi,

I have to achieve the following goal in JIRA cloud-

  • When user inputs plain text in a field, Jira should read the entered text, create a PDF file containing that text and add it as an attachment to the same issue.

Here is what I tried-

  • I created a transition called "Add Report" and put a screen in it and added a field "Add Report" to that screen, in this field users are supposed to input plain text (The idea is that the user will need to click on that transition to enter the text. When they enter it and submit, a post-function will be used to achieve the goal)
  • I created a ScriptRunner post function in which I tried to make Jira read the value from the field "Add Report", and create a pdf file with that content and then use a REST API call to post the attachment to the issue.

But the scripts didn't work at all specially because in Jira cloud we don't have a location to store the file from where it can be fetched.

 

I'm new to Jira Cloud and using REST API, hence, there may be some method that I don't know about which can fulfill the requirement.

Hence, requesting for help.
I have the following plugins-

1) Scriptrunner
2) Automation for JIRA (Paid version)
3) BetterPDF Exporter

Thank You!

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Champion
December 6, 2023

Hi Manish,

I can confirm with ScriptRunner that adding an attachment to an issue is possible by calling the Add Attachment API.

However, it is impossible to generate a PDF as this would require extra dependencies, which we do not support as we only support using the standard Java 11 packages as documented here.

This means it is impossible to generate the PDF to attach to the issue using ScriptRunner for Jira Cloud.

However, you could generate  HTML instead of using ScriptRunner, similar to the approach shown in the example here and then attach this to the issue as a workaround.

I hope this information helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events