I have a Jira project with issues that have PDF attachments. The initial request was to provide a way for users to "click a button" to send an email to a user list, maintained in a separate field, that includes the attachment. I solved that with a manually triggered automation rule that fired a custom event and a Scriptrunner listener that hears that event and grabs the attachment (who's filename ends in '.pdf') and sends it. Works fine.
Now they want to allow the user to select from potentially multiple attachments in the ticket and send those and I'm not sure how (best) to solve this.
I can use a Scriptrunner fragment button to pop-up a dialog that will list the attachments (I think) and allow the user to select the one(s) they want to send but I'm not sure how to pass that info to the listener. The reason I'm using the listener is I don't know of any other way to send mail with attachments. I can send html emails through a standard script but I don't see a way to include attachments. If there is a way to do that in a groovy script that would be best.
Failing that, is there a way to send a payload in an event such that my listener could determine which files were selected? The only solution I can think of is to save the list of selected files in a hidden field and then have the listener look at that.
Maybe I'm blinded by my first solution and there's an easier way for all of this???
Thanks