Hi,
I am trying to create a linked Jira ticket using ScriptRunner 'clone and issue, and links' post function. We want the new issue to copy all fields from parent issue but skip the attachments. I tried below code but it throws NullPointerException probably because the linked issue is not created yet.
def attachments = ComponentAccessor.attachmentManager.getAttachments(issue)
attachments.each {attachment ->
attachmentManager.deleteAttachment(attachment)
log.error("attachement removed in loop")
}
Please suggest if there is any other way to skip the attachments?
Hey @Susheela Kushwaha ,
You should be able to skip the copying of attachments by inserting the below code in the Additional issue action field in the same post-function:-
checkAttachment = {attachment -> false}
This is also documented in ScriptRunner's documentation if you require any further information:-
Hope this helps.
Regards.
Hi @Adrien Low _ServiceRocket_
This is perfect and exactly what I was looking for. Thank you so much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.