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.
The attachment field is a standard Jira field and is not one that you have to create.
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
Select the Project where you want to apply this
Click on Project Settings on the left hand menu
On the left hand menu click on Screens
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
Add the attachment field
If you would also prefer to have the attachment field show up during the transition, click on the Workflows link on the lefthand menu
Under Actions click on the pencil icon next to the workflow where you want to make this change
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.
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.
Under the Transition View, select the Screen you want to appear in the transition and hit update
Now click on the Screen link and add the Attachment field
Now hit the back button on your browser
Click on the Validators tab in the workflow
Click on Add validator
Select “Build-your-own (scripted) Validator (JMWE app)” and hit add
Under Error message you can add something similar to “Attachment must be Excel” and then click Update
Now Publish Draft
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.
Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...
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