Forums

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

How to add attachments to script runner email

Harsh Patel
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!
October 15, 2020

I am using JIRA cloud and I am trying to use ScriptRunner to send an email which includes the attachments from the ticket.

 

The ScriptRunner documentation states that it is possible but I don't see an option for that in the ScriptRunner Post Function. The documentation also states that there is an inline example for this but I do not see it: https://scriptrunner.adaptavist.com/4.3.8/jira/builtin-scripts.html#_attachments_in_emails

 

It seems like I cannot use ScriptRunner script because JIRA cloud does not allow importing of the `import com.atlassian.jira.*` namespace.

1 answer

1 accepted

1 vote
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
October 16, 2020

Hi Harsh,

Thank you for your question.

I can confirm that the reason that your code above will not work inside of ScriptRunner for Jira Cloud is due to the fact the code you have provided is for ScriptRunner for Jira Server and this will not work as Atlassian only provide a rest API in Jira Cloud and do not provide a Java API in the cloud-like they do in Jira Server.

You can see more detailed information on the differences between the cloud and server versions inside of our documentation page located here.

This means that the only way inside of ScriptRunner for Jira Cloud is to call the Send Notification for Issue Rest API  which Atlassian provides and I can confirm we have an example of calling this API in the documentation page located here.

However, I can confirm that Atlassian does not permit adding attachments using this api which means that it will not be possible to send attachments in an email using ScriptRunner for Jira Cloud due to the fact that Atlassian does not provide an API to achieve this.

Regards,

Kristian

Suggest an answer

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

Atlassian Community Events