Hello, community
I have a big problem. In the workflow, I added a custom validator whose purpose is to check if the attachment is uploaded.
Here's a fairly common line of code I wrote:
def attachments = issue.getAttachments()
log.warn("attachments size: ${attachments.size()}")
Hi @James Lebron Try to add Scripted Validator :-
It check Attachment should be empty. Atleast one attachment is mandatory.
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.attachmentManager.getAttachments(issue).size() > 0
Thank you for your advice, but unfortunately, this code and my code execute the same result, both are empty.
During the workflow transition, I uploaded the attachment, but it was still not available in the validator
I wonder if it has something to do with an attachment plug-in named ‘SMART ATTACHMENTS’ I use?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @James Lebron In my code, you won’t be able to transition the issue until you attach at least one attachment. When you attach an attachment , you won’t get an error message and issue get transitioned.
In this you no need to attach transition screen, it works without transition screen. Give error message on view screen.
I am using Scriptrunner plug-in >> Scripted Validator.
Thanks
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.