How to validate the number of attachments on a screen in jira5.0.5

Currently, I am using TemporaryAttachment API to get the number of attachments on a screen. The problem however is that when someone attaches a file on jira screen and unchecks the check box to the left of it, there is a file in temporary attachments collection but no file is attached to the issue. Effectively, this practice can bypass my validator. Is there any possible way to make a fullproof validation.

3 answers

1 accepted

Thanks, works perfectly for me.

Map<String, ModifiedValue> modifiedValueMap = mIssue.getModifiedFields();

ModifiedValue modifiedAttachmentValue = modifiedValueMap.get("attachment");

List<String> modifiedAttachmentList = (List<String>) modifiedAttachmentValue.getNewValue();





Glad to be of any help.

Hello All, 

Kindly help me for this problem, i am not able to get screen attachment name ..............



Hi Smruti,

The links Radu shared doesn't work so could you paste the code you wrote?

One more favour, I also try to use a validator which checks whether an attachement is uploaded or not while creating an issue. I mean I don't want users to create an issue without an attachment.

Hi Dolanbay,

I have posted the code which worked for me below Radu's links. You can add the validator at create step for your requirement. Adding the validator at create will not allow anyone to create an issue without attachment.



Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,183 views 13 19
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