Hi,
Could some one help me with escalation service automation ? I have tried to add stopWatching functionality for issues which are handled with escalation service, but no success yet.
code part from latest trial:
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserByKey("<As User userid>")
watcherManager.stopWatching(user, issue)
what may be wrong in here ?
Hi @Renni Verho ,
This seems correct ! I suspect the user may not retrieved correctly though, may you please add this line to check if this is the case :
log.error("user : " + user)
and then look at the logs ?
Antoine
There may be a bug. by some reason format is username(username) - I assume user should be username just once.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no checked similar transition script and it works correctly with similar user information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So the script is working sometimes ?
You should check the logs when it is not working. Also make sure the user you are triggering the post function with has enough rights to manage watchers.
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tested script with another users and it woks ok.
Problem is only for user in "As User" field, it cannot be removed inside escalation script.
Any ideas how to remove runner user from watcher list ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What I mean is the user running the script should have enough rights in the project permissions :
If you want to remove the currently logged in user from the watcher, use this instead :
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User running the script have enough rights and stopWatching in Escalation service looks working ok.
Found out that problem is due Autowatch function running order in Jira. We use "Inherit from global settings" for autowatch in user profile and Default user preference is yes.
That means removing "As User" person in script does not work, because autowatch adds user after script end.
Verified theory by changing Autowatch to Disabled for "As User" user and watch setting stays clean.
Next step may be to find workaround how to turn autowatch off during script running or something like that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see, that makes sense. Good job finding out. :)
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.