Forums

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

How can I get attachments name while issue creation

aas
Contributor
March 5, 2020

I need help to get attachments names in post function on issue creation transition. 

1 answer

1 accepted

1 vote
Answer accepted
PD Sheehan
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 5, 2020

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

aas
Contributor
March 5, 2020

Thanks! I've alrady found it

Bhanu Priya KS June 11, 2020

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. 

PD Sheehan
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.
June 12, 2020

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.

Suggest an answer

Log in or Sign up to answer