Hi !
I have to perform special actions on certain attachments and comment, so I have created a transition where users can add attachments and a comment.
How can i identify/get in a database or a file the ID of the attachment and comments that are filled in a specific transition ?
I read about post fonction using groovy script runner, but i'm not sure if it's really possible.
Community moderators have prevented the ability to post new answers.
You will need to iterate through the issue change history (com.atlassian.jira.issue.changehistory.ChangeHistory) - in that you will the action ID where each attachment was added.
i'll try to write the script ( first time writing groovy for me, i may need some help after ^^ ) thx for the hint
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
following jaimie's advice, i wrote this simple script and added it as a post function for a workflow transition :
import com.atlassian.jira.issue.changehistory.ChangeHistoryManager import com.atlassian.jira.component.ComponentAccessor ChangeHistoryManager chm = ComponentAccessor.getChangeHistoryManager() def chg = chm.getChangeHistories(issue) def id = 0 def taille = chg.size() File file = new File("/test.xml") for ( i in 0..taille) { if (chg[i].getId() > id) { id = chg[i].getId() } } String strLong = Long.toString(id); file.write strLong
But with this i don't get the ID of the last change of the issue ( that just happened ) but i get the ID before the last change.
Am i missing something and am i in the right way ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the attachments are only coming on an specific transition, you can use the transition ID (you can get that in the Workflow screen) and then craft your script to act when that transition happens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi !
acting after the transition isn't a problem, for me it's the purpose of the post function right ?
the problem id to identify the attachments and comment added in the transition, on a file or on a table.
if i craft a script and use it as a post function, can i get in this script the attachments and comment (name or id)
added in the transition ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @yannis meriel, have you found a solution for this?
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no i do not have a solution yet , but i'm working on it again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.