There is a suggested approach for doing this on the scriptrunner documentation
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.ComponentAccessor
ComponentAccessor.attachmentManager.getAttachments(issue).any{it.filename.contains("something")}
And you select the appropriate action based on the conditon check.
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.