Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,059
Community Members
 
Community Events
168
Community Groups

Condition for making no of Attachment mandatory in a specific transition in workflow.

Is there any optional script that can be used to make 

 

4 attachments mandatory at a specific transition in workflow of jira.

 

 

 

 

1 answer

0 votes
Will C Rising Star Feb 17, 2020

Use a simple scripted condition in a workflow post functions using scriptrunner and use the following code:

import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.attachmentManager.getAttachments(issue).size() >= 4

I am presuming this is what you want? this won't let you transition the issue unless there are 4 or more attachments attached to the current issue. 

@Will C  thank you

 

I had the Script for 4 or greater in an issue.

is there any option at a specific transition i 4 attachments ??

Will C Rising Star Feb 17, 2020

Sorry I don't understand your question? so you know there is 4 attachments at a specific transition in the workflow, what are you want to do now?

Daniel Ebers Community Leader Feb 17, 2020

Starting off here you could do some further actions based on ScriptRunner (please see here for further documentation: https://scriptrunner.adaptavist.com/5.6.15/jira/recipes/workflow/validators/validate-attachments-links-in-transition.html).

Cheers,
Daniel

sorry ill elaborate, 

when i make a transition, i have a pop up screen which requests for a attachment.

at that point i need to make a validator scritpt that if user doesnt attach 4 attachments.

 

the transition gives an error.

Will C Rising Star Feb 17, 2020

I understand what you want to do now, I am not sure if the pop up part of this is possible. it is possible to check for attachments and then put an error against a field when this isn't met, but the part with a pop up I am not sure of, maybe somebody from Adaptavist will be able to advise further.

Like siva likes this

@Will C 

@Daniel Ebers 

Hello Both, Greetings!

is there any way to make attachment based on condition and moves the transition.

like i have a custom field is "Total Amount" 

If the total Amount is >= 10000 then attachment is mandatory to attach.

and IF the total amount is <10000 then attachment is not required. 

Kindly advice.

Suggest an answer

Log in or Sign up to answer