I need help to get attachments names in post function on issue creation transition.
There is a suggested approach for doing this on the scriptrunner documentation
https://scriptrunner.adaptavist.com/5.0.3/jira/recipes/workflow/validators/validate-attachments-links-in-transition.html
Thanks! I've alrady found it
Hi Peter,
Is it possible to get the attachments on Issue create event and not on transition? I want to get the attachment names on creation of an issue and then decide to what status the issue should transition to.
Without researching this, I wonder if that approach is even possible. I am not aware of any way to conditionally go to different status after transition.
The best option is to use the FastTrack Transition option in scriptrunner. This lets the create transition go to the default status, then immediately perform the transition from the default status to the appropriate status.
You would setup 2 FastTrack post function, and in each you add a condition like:
import com.atlassian.jira.component.ComponentAccessorComponentAccessor.attachmentManager.getAttachments(issue).any{it.filename.contains("something")}
And you select the appropriate action based on the conditon check.
It looks like you're new here. Sign in or register to get started.