Am I able to use Scriptrunner to add a Watcher using an email address as the value? The email address would come from custom field type "Text Field (single line)". This script would run on the "Create" transition of the Issue workflow.
I've had a look at some example scripts but my understanding of Groovy is very limited.
Any assistance would be very much appreciated.
Thanks for the reply Alejandro. Only an email address, of users already in the JIRA internal directory, would be used.
This thread seems to contain some scripts that may get me there - https://community.atlassian.com/t5/Answers-Developer-Questions/How-do-I-add-a-specific-user-as-a-watcher-using-script-runner/qaq-p/569185
Could anyone please suggest a change to the below script that would allow the use of the user account email address instead of user name?
MutableIssue issue = issue
def cfManager = ComponentAccessor.getCustomFieldManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def cf = cfManager.getCustomFieldObject(“12046”)
def u1 = issue.getCustomFieldValue(cf) as ApplicationUser
Please note, I'm getting an error when running the above script but seems to be close to what I would require.
Any assistance appreciated.
Hi everyone 👋, I really like the format of the webinar opportunities summary that @Jimmy Seddon posts monthly on the Welcome Centre group. It's a great place to go to check that you didn...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events