Hi
I want to validate the attachment name when user create issue.
If the attachment name is not valid, they can not create issue.
And below is my code.
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.attachment.FileSystemAttachmentDirectoryAccessor
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
def attachmentDirectoryAccessor = ComponentAccessor.getComponent(FileSystemAttachmentDirectoryAccessor)
File temporaryAttachmentDirectory = attachmentDirectoryAccessor.getTemporaryAttachmentDirectory()
def newAttachmentNames = issue.modifiedFields.get(IssueFieldConstants.ATTACHMENT)?.newValue[0]
def fileName = new File(temporaryAttachmentDirectory, newAttachmentNames as String).getName()
But the value will like 'temp1337765752408737186'.
How to get real attachment name when project create.