You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi All,
Need help to implement transition validation with JIRA MISC WORKFLOW EXTENSIONS
Please share your thoughts on this how to implement this? Also, https://community.atlassian.com/t5/Jira-Software-questions/Use-Case-Verify-Attachment-Type-When-Transitioning/qaq-p/1631128 I tried this but this is limited to transition screen and this is not working for me :)
Any help would be appreciated and TIA
You can use a Build-your-own Validator for this. The Jira expression should be something like:
issue.attachments && issue.attachments.some(att => att.filename.toLowerCase() == "some file.xls" && att.mimeType == "some mime type")
You'll need to figure out the exact mime type by adding the desired file to an issue and then testing the following expression against that issue:
issue.attachments[0].mimeType
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks David for the suggestion , this validation limited to the transition but Is there any away that we can check whether the ticket already has attachment of specific file while doing certain transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry but I didn't understand your question. Can you please elaborate?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Fischer _Appfire_ - Adding the suggested validation in the transition is limited to the transition screen and it checks whether the specific file (name and format) is attached to the screen or not to move forward with the transition.
However, I want have a additional condition to check whether the file is already attached to the ticket or not then enforce the user to attach the file during the transition if not already present in the attachments else allow the transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code I provided does take existing attachments into account - attachments that were already attached to the issue before the transition started.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks David. I have added below code but still transition is enforcing to attach the document once again though the RiskAssessmentMatrix.xlsx/riskassessmentmatrix.xlsx is already attached to the ticket.
issue.attachments && issue.attachments.some(att => att.filename.toLowerCase() == "RiskAssessmentMatrix.xlsx" && att.mimeType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Fischer _Appfire_ - Did you get a chance to review the above? As I mentioned it is not checking the ticket attachements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
You need to use a lowercase version of the file name to check. Or if you're happy with a case-sensitive comparison, remove ".toLowerCase()" from the script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Fischer _Appfire_ - I'm actually using the file name in lower case only (riskassessmentmatrix.xlsx) but still it is enforcing to attach again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you temporarily replace the validation script with this:
JSON.stringify(issue.attachments)
and then try to transition an issue that already has the required attachment, and post the resulting error message here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Fischer _Appfire_ - Please find the error details after performing the transaction with the given script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, my bad. Can you check this script instead:
JSON.stringify(issue.attachments.map(att => {filename:att.filename, mimeType:att.mimeType}))
and report the error here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Fischer _Appfire_ - Below message is showing in the validation screen with the given script.
[{"filename":"riskassesmentmatrix.xlsx","mimeType":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then you need to make sure that your code is checking for exactly that filename and that mime type.
issue.attachments && issue.attachments.some(att => att.filename.toLowerCase() == "riskassessmentmatrix.xlsx" && att.mimeType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.