Hello,
I have a problem with create and insert a pdf via a listner. If an user uploads a pdf one of my scripts is started to copy the pdf and inserting an annotation and safe it as well in the same issue. That works good, but I have no idea how to update my issue. I found examples for costume fields like this:
issueInputParameters.addCustomFieldValue(projectPage.getIdAsLong(), pageUris["mainPageUri"])
def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def validationResult = issueService.validateUpdate(loggedInUser, issue.getId(), issueInputParameters)
But I don't know how to update the attachment field.
You need AttachmentManager to upload attachment to an issue.
It has copy , create and delete attachment methods that you can user accordingly.
Regards
Prakhar
I did so.
CreateAttachmentParamsBean createAttachment = new CreateAttachmentParamsBean.Builder(
attachmentNew,
issue.key + "_annotated.pdf",
invoice.mimetype,
invoice.authorObject,
issue
).build()
attachmentManager.createAttachment(createAttachment)
But my problem is, that the issue is not updated with that method. So the history don't show me, that a new pdf is inserted. And I think that could lead to some problems in the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make sure the issue is persisted in the database before you try to create attachment. Try to log if there is any exception and share the log.
Regards
Prakhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sure that the issue is persisted in the database. I don't create the issue. The issue is already there. I get no exception. My script is running well. The only thing is, that I think I have to make something like
issueService.validateUpdate
after changing something in my issue via a listener script.
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.