Workflow Transition Condition for attachments and/or links

I would like to put a condition on a workflow condition that requires the user to either include an attachment or a link to the issue before they continue. Is this possible?

2 answers

I know this is really old but this is the way I did it.  I needed the user to have an attachment called ReadMe.txt so I added the following scripted validator and it works.

Script workflow function : Simple scripted validator : Checks script:

issue.getAttachments().find {it.filename.contains("ReadMe.txt")}

Unfortunately it is case sensitive.  I will have to find a way to .ignoreCase

This did it: issue.getAttachments().find {it.filename.toLowerCase().contains("readme.txt")}

Think there is a way to make that check for a null value on the filename? 

I am sure there is but would have to play.  Right off I would try:

  ! (issue.getAttachments().find {it.filename} )

Robert, thanks for posting this - Did not matter that it was a years old thread, just made my day!

Cheers :)

Hi @Robert G. Nadon,

great post!

I am trying to accomplish validating that there is an attachment with the following naming "PR Form"

I added a validation to the workflow transition but is does not work. any suggestions?



issue.getAttachments().find {it.filename.contains("PR Form")}


First off you need to have the script running plugin.   I would make sure that is bought and enabled.  After that there is a space within "PR Form"  That is not good for filenames.  I would see if you change both filename and query to "PRForm" and see if that works.  Also to avoid case sensitivity maybe try:

issue.getAttachments().find {it.filename.toLowerCase().contains("PRForm")}

Also @Brian W. Bishop I have no idea how to check for a null filename.  How would you even create a file without a filename?!?

@Robert G. Nadon- thanks for the quick replay!

issue.getAttachments().find {it.filename.contains("PR Form")}

worked for me!

another thing-

if i want this validation to work only if another costume field is X can I do it?

For example, this validation should work only if "Animal Type = Dog"

You bet google around and you should find the answer.   That's how I do it :)   I did a quick google and found:


so This would probably work

if ((issue.getAttachments().find {it.filename.contains("PR Form")}) and (getCustomFieldValue("AnimalType") == "Dog") )

 { Do the dog thing }

Or something like that.   You may need the function ToString() as well as I have needed that before.  

Best Luck...


thanks! I'll try it out!

0 vote
Timothy Chin Community Champion Jan 19, 2013

Can't seem to find a condition but there is a validator in JIRA Misc Workflow Extensions.

Thanks for the response. We decided to require the links to be a URL custom field, so we could check to make sure that field was not empty. There was also a script condition that allowed to check for 1 or more attachments present befor allowing the transition

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted yesterday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

246 views 35 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot