Hi everybody,
I'm working on a project where I have two workflows. One for the main ticket and one for the many subtasks that can be created during the main ticket resolution process.
When I close a subtask I have a screen with an "attachment" field allowing the users to add a document to the subtask and with the help of a script the document is also added to the main ticket.
It's working fine.
The problem occurs if I re-open a subtask to which a document has been attached on the "close" transition. When I will close this subtask again, the attachment I added the first time will be added again in the main ticket. So I have the same document two times in the main JIRA. That's a big problem for my project.
So I tried to add a "clear field value" script on "attachment" field on the "close" transition (after the script that send the attachment to main JIRA of course) but it doesn't works.
I use the "clear field value" script on many transitions to reset te values of many fields and it works perfectly. The problem only concerns the "attachment" field. For example it works perfectly with the "assignee" field and "delivery date" field.
When I try to purge the ttachment field an error occurs and JIRA send a message advertising me that the transition is impossible to execute.
You can see the screenshot below:

I tried on different transition. Even on transition of the main ticket workflows. I still got the same error.
Do you have any idea on how I can "purge" the attachment field?
I'm using script runner 5.1.6 and JIRA 7.2.0
Thanks in advance!
Regards,
Germain.