Forums

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

External attachment jira

Pumper1 June 4, 2018

Hi, i try to create external Attachment in jira with groovy. How i can do it?

1 answer

0 votes
Tyler Brown-Jones June 4, 2018

Could you explain your request in a bit more detail @Pumper1

Pumper1 June 4, 2018

@Tyler Brown-Jones Hi, i have two projects. Software and service desk. And i create a listener which copy attachment from software to service desk. But it copy as internal(not external) hov i can set it as external(vissible on customer channel)

Tyler Brown-Jones June 4, 2018

Can you check that your customers have permissions to view and add attachments? 

Project administration -> Permissions -> Make sure you add "Service Desk Customer - Portal Access" to Create Attachments.

Please let me know if this doesn't resolve your issue.

Pumper1 June 4, 2018

Yes, but issue is that they cant view attachment which is coppied from software project issue

Tyler Brown-Jones June 4, 2018

The only fix for this would be the agent adding a comment in to the service desk ticket and attaching the attachment you have added via the script listener to this comment. Perhaps catch when an attachment is added to an issue using a script listener and add that attachment within a comment? 

Just fruits for your thoughts.

Feel free to ask any questions.

Pumper1 June 5, 2018

i add attachment i Software project, then i copy it to the SD, and it is not wisible on customer portal. 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.util.AttachmentUtils
import com.atlassian.jira.issue.attachment.Attachment
import com.atlassian.jira.issue.attachment.CreateAttachmentParamsBean
CommentManager commentManager = ComponentAccessor.getCommentManager()
def CurrentUser = ComponentAccessor.getUserUtil().getUserObject('user')

def issueService = ComponentAccessor.getIssueService()
def componentManager = com.atlassian.jira.component.ComponentAccessor
def attachmentManager = componentManager.getAttachmentManager()
def issueManager = componentManager.getIssueManager();
def issue = issueManager.getIssueObject("SD-1067")
def linkMgr = ComponentAccessor.getIssueLinkManager()
def sourceAtt = attachmentManager.getAttachments(issue).last()
File attachmentFile = AttachmentUtils.getAttachmentFile(sourceAtt);
def user = ComponentAccessor.getJiraAuthenticationContext()?.getUser()
attachmentManager.copyAttachment(sourceAtt, sourceAtt.getAuthorObject() , issue.key)

Suggest an answer

Log in or Sign up to answer