The field does not have a value.
You need to work with a file that Jira needs to retrieve for you which is very different from a field value. Could you explain exactly what you want to do with the attachments here?
For eample, do you need the information about where the user is uploading from? The content of the file? The file name the user gives? The file name Jira will use on disk? Something else?
You need to create or obtain an attachmentManager object in your code, then you can use the function getAttachments(Issue) to get the list of attachments. You can then get some more information from the attachment objects - getAuthor, getFilename and so-on. There's no md5 function built-in, you'll need to code that for yourself
The main goal is to get the name of the file that we are attaching and add the filename to a field using postfunction.
And also before attaching we need to compare whether this file is existing, by generating the checksum of the file we are attaching and comparing with the files, which are already attached. If the file exists then we need to throw an error to the user. - Validator
Is this feasible?
Ah, that's not quite what you said - I was unclear on whether you meant "the file to be attached by the user" and "the file already attached to the issue". You actually need both! You've also got two separate processes to do
So, you do the validation first. Your code will need to
Secondly, you want the file name in a field. As you say, that's a post-function, to run after validation, but is easier. All you need is Onkar's code again, with a line that gets each file name and puts it into your field.
We're looking for participants for another workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sh...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG