Forums

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

scriptrunner script how to check the condition if attachment was added (uploaded) in post function

uvo3 main public name
Contributor
September 12, 2023

I'm wondering,
How to check condition in the post function by script runner script  :
Is an attachment was added from transition screen or not?
I'm working on add the condition in my code. The idea is check if attachment was added in transition screen. My script placed in post function 

Is it possible to grab files attached on transition screen by Scriptrunner custom script in post function?
The add attachment is not mandatory action.

1 answer

1 accepted

1 vote
Answer accepted
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2023
uvo3 main public name
Contributor
September 15, 2023

Thank you for your suggestion.
I'm afraid this way doesn't fit me because
The aim is check attch adding action in the post function
Is it possible to grab files attached on transition screen by Scriptrunner custom script in post function?
when adding attachment is not mandatory action.

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 15, 2023

I think the first link (further in the comments) describes just that, checking the files added in the transition, on the transition screen.

Jeroen

uvo3 main public name
Contributor
September 15, 2023

Unfortunately, It doesn't work in post function.
The code works well as validator in Validation of transition  

uvo3 main public name
Contributor
September 15, 2023

Euuu  ;) Thank a lot for you help.
The suggested approach works well for me.

I've move my script to Validation of transition from Post function. It was so easy.
Thanks again.

uvo3 main public name
Contributor
September 15, 2023

One more things. Do you know is it possible to get Attachments from Validator?

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 15, 2023

Hi,

I'm not sure but since the attachments are already on the issue when the Validator tiggers, I think you can just use the attachmentManager service. This article should get you started (the code in the question, not the answer :-)):

https://community.atlassian.com/t5/Jira-questions/Jira-Groovy-Script-Runner-get-list-of-attachments-in-a-screen/qaq-p/1619014

Jeroen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13
TAGS
AUG Leaders

Atlassian Community Events