Forums

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

How add a comment in issue creation transition

aas
Contributor
March 6, 2020

I need to add comment with attachments names and this script has to work on issue create transition. I found out how get attachments of not yet created issue https://scriptrunner.adaptavist.com/5.0.17/jira/recipes/workflow/validators/validate-attachments-links-in-transition.html but can't add comment.

commentManager.create(issue, currentUser, attachNames.toString(), true)

issue is null here so I have illegal argument exception

1 answer

1 accepted

1 vote
Answer accepted
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2020

Perhaps your post function occurs too early in the list of post functions. On a Create, the first post function by default is Creates the issue originally. If you place a post function before that (that attempts to write a comment, etc.), then as you find, the issue does not yet exist. Try moving your post function down in order, using the arrow icons that appear when you hover over the post functions.

aas
Contributor
March 10, 2020

Thanks, it works. And I don't have to get attachments names so difficult  way, i just can 

def attachManager = ComponentAccessor.getAttachmentManager()
def attachs = attachManager.getAttachments(issue)

without TemporaryWebAttachmentManager

Like Payne likes this

Suggest an answer

Log in or Sign up to answer