Hi ,
I am getting following error
Time (on server): Mon Oct 16 2017 17:37:53 GMT-0700 (Pacific Daylight Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2017-10-16 17:37:53,779 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2017-10-16 17:37:53,779 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: CR-2024, actionId: 1, file: <inline script> groovy.lang.MissingPropertyException: No such property: event for class: Script54 at Script54.run(Script54.groovy:8)
Here's my script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.watchers.WatcherManager
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def issue = event.getIssue()
def user = userManager.getUserByName("Brian66481")
if (issue.getIssueType().getName() == "RE Task") watcherManager.startWatching(user, issue)
Please help
Hello Pritesh,
the problem seems to be at the line "def issue = event.getIssue()". The event variable is not available for your script.
I think if you will delete the whole line, the issue will disappear (as the issue variable is automatically available in post function scripts).
Please let me now if it helped.
Regards,
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Martin,
Unfortunately it still doesn't work.
Following is the error-
Time (on server): Wed Oct 18 2017 10:06:10 GMT-0700 (Pacific Daylight Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2017-10-18 10:06:10,286 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2017-10-18 10:06:10,302 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: DBCR-443, actionId: 1, file: <inline script> groovy.lang.MissingPropertyException: No such property: event for class: Script210 at Script210.run(Script210.groovy:17)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Martin!!!!!!!!
Thanks soooooo much!!!!!!! Been struggling from past 2 days!
It worked!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.watchers.WatcherManager
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserByName("Brian66481")
if (issue.getIssueType().name == "RE Task")
watcherManager.startWatching(user, issue)
One more help - I want to add user as a watcher based on task type and specific components.
Could you help me with that please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Pritesh,
sorry I couldn't answer you sooner but I see by your posted answer that you made it past your problem. Great to hear that!
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.