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 - 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 - 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 - 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 - 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 - 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.
@David Fischer This has helped me with a similar dilemma. However, I'm wondering how I would modify the JQL to include more than one document type with the same name i.e. Document.xlsx or Document.docx. I'm currently not utilizing the portion of the script below
&& 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.
I was actually able to figure this out, but I'm having another issue altogether because of the validator. To be continued...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.