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,296,599
Community Members
 
Community Events
165
Community Groups

Use Case: Verify Attachment Type When Transitioning

How to Validate An Attachment is Excel

Tested and Documented in Jira Cloud

What is the Business Need?

Jira allows for any type of attachment to be added to an issue.  If you have an issue type that requires an attachment and the attachment needs to be an Excel file, you will want to use this validator.  One use case is if you have purchase orders that are being created in Excel and you need the purchase order attached to the Jira issue before you can resolve the issue.  

Steps

  1. The attachment field is a standard Jira field and is not one that you have to create.

  2. Ensure the attachment field is on one or more of the following screens: view, edit or transition screen.  Navigate to the Main Menu Bar -> Administration Cog -> Projects

  3. Select the Project where you want to apply this

  4. Click on Project Settings on the left hand menu

  5. On the left hand menu click on Screens

  6. If you have more than one screen scheme, select the issue type where you want to make this change and click on the Create and/or Edit Screen

  7. Add the attachment field

  8. If you would also prefer to have the attachment field show up during the transition, click on the Workflows link on the lefthand menu

  9. Under Actions click on the pencil icon next to the workflow where you want to make this change

  10. For this example, let’s say you want the screen to show up when you are moving the issue from Backlog to In Progress.  Click on that transition.

  11. If there is “None - it will happen instantly” under the Screen section, then click on the Edit button on the upper right hand side of the screen.

  12. Under the Transition View, select the Screen you want to appear in the transition and hit update

  13. Now click on the Screen link and add the Attachment field

  14. Now hit the back button on your browser

  15. Click on the Validators tab in the workflow

  16. Click on Add validator

  17. Select “Build-your-own (scripted) Validator (JMWE app)” and hit add

  18. Add “issue.attachments[0].mimeType.includes(‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’)

  19. Under Error message you can add something similar to “Attachment must be Excel” and then click Update

  20. Now Publish Draft

  21. Let’s test it out! 


If you want to validate a different attachment type, you can create a test ticket with the attachment type you want to use. Now use the API to get the attachment information. I used HTTPBot and use this URL: https://<domainname>.atlassian.net/rest/api/3/issue/<issuekey>. On the output, scroll to the bottom and you will see mimeType. That is what you will copy and use in the script.

 

2.png1.png

0 comments

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,583 views 37 45
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you