Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,554,036
Community Members
 
Community Events
184
Community Groups

Validation in the transition to check ticket has an attachment with file name (RAM) and format

Edited

Hi All,

Need help to implement transition validation with JIRA MISC WORKFLOW EXTENSIONS

  • Validate whether the ticket has an attachment with the specified file name 
  • Validate the specified file is in excel format.

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

2 answers

2 accepted

0 votes
Answer accepted

Error.JPG

@David Fischer _Appfire_ - Please find the error details

0 votes
Answer accepted
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 09, 2023

Hi @Ravi Kumar Boddu 

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

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.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023

Hi @Ravi Kumar Boddu 

I'm sorry but I didn't understand your question. Can you please elaborate?

@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.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023

The code I provided does take existing attachments into account - attachments that were already attached to the issue before the transition started. 

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")

@David Fischer _Appfire_ - Did you get a chance to review the above? As I mentioned it is not checking the ticket attachements.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023

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. 

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.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

Hi @Ravi Kumar Boddu 

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?

Error.JPG

@David Fischer _Appfire_ - Please find the error details after performing the transaction with the given script.

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

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? 

@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"}]

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

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")

@David Fischer _Appfire_ -Thank you so much your help here. Its working now.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events