Hello,
I've created a script to send an E-Mail to watchers of the parent issue upon creation of a subtask. The script is based very much on the built-in SendCustomEmail.groovy; in fact, it is only an additional seven lines. (Why re-write functionality if you can use existing one.)
Unfortunately, the SendCustomEmail.groovy uses additional parameter fields that I cannot use. Is there a way to use custom parameters for custom scripts? Alternatively, if Jamie Echlin reads this: Do we have a chance of this functionality being built-in? I will happily send you those seven lines to add :-)
Kind regards
Ruben Straube
If you have subclasses the script or just copy and paste it you should see the parameters when you add it to a workflow. So I don't really get your question, if you could use the original why can you not use your copy?
> Do we have a chance of this functionality being built-in? I will happily send you those seven lines to add
Depends what the 7 lines are! What do they do?
> you should see the parameters when you add it to a workflow.
It is not added to a workflow, it is a "Script Listener" that should listen to the "issue created" event (If the created issue is a sub task, the watchers of the parent issue should be notified).
So we go to "Script Listeners" in the admin area, and no matter where we put our Listener, only the built-in ones are displayed. Choosing "Custom listener" does not give us the parameters we defined (obviously).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, what version of Script Runner are you using, and where are you putting it?
It needs to have the @ScriptListener annotation for listeners.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To add to what Martin wrote:
Those lines are to use the parent issue's watcher field; it's a functionality we've been asked about a lot recently. I only added
else if (f == "parentwatchers") { if(issue.isSubtask()) { watcherManager.getCurrentWatcherUsernames(issue.getParentObject().genericValue).each { String username -> addresses.add(userUtil.getUser(username).emailAddress) } } }
into the long if .. else if clause in the function getAddressesFromFields(...).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK that's related to that other discussion? Can we keep that separate.
Again: Well, what version of Script Runner are you using, and where are you putting it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The full script is this one here: https://www.refheap.com/89702
Since the code is essentially the same as the SendCustomEmail.groovy with some additional lines and another class name, the annotation @ScriptListener is there.
The script runner version is 3.0.3. It doesn't matter if I put it into the scripts folder or paste it; the class is found, but I still get the same parameters as any custom script and not the same as for the custom email listener.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'll try to repro later.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.