You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi all!
I'm trying to get attaches were attached during transition as a files.
I can get them using
def attaches = issue.modifiedFields.get(IssueFieldConstants.ATTACHMENT)?.newValue
and i get list of temporary filenames. And i can get them like files using
attaches .each{attach ->
log.warn 'New Attach'
log.warn attach
newAttList.add(new LazyMap ('fileName': attach, 'file':new File(temporaryAttachmentDirectory, attach)))
}
But there are not properly filenames - only temporary like temp2135062013794563645. So i can't do anything correct with this files.
Otherwise, i can get list of TemporaryWebAttachment objects using
def temporaryAttachmentUtil = ComponentAccessor.getComponent(TemporaryWebAttachmentManager)
def formToken = ActionContext.getRequest()?.getParameter(IssueFieldConstants.FORM_TOKEN)
def newAttaches = temporaryAttachmentUtil.getTemporaryWebAttachmentsByFormToken(formToken)
But i couldn't find out how can i get File object from TemporaryWebAttachment. It has filename property, but it's only name of file wich was attached, but i can't find it nowere in filesystem. Also i can't attachment from issue via attachment name - only by attachment id. But i can't get attachment id information from TemporaryWebAttachment.
Anybody knows how to get file object from transition attachment? I'll be greatly thankfull.
Just found it by myself.
TemporaryWebAttachment.getStringId() returns exactly temporary attachment name
so i could get File like this:
new File(temporaryAttachmentDirectory,TemporaryWebAttachment.getStringId())
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.