As a user or project level administrator, when I try to create a Bug Tracking (JIRA Software) project by clicking on the Bug Tracking link, the application displays the Bug Tracking page, but the "Use Template" button is disabled. Kindly let me know how the JIRA admin can enable this USE TEMPLATE button for the user, without providing JIRA administration rights to the user or project admin.
Hi,
If this is a post function then your code should be as follows. I'm going to assume that ID of your custom field is 11111 and its type is 'text (single line)'.
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.getUserManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
def cf = cfManager.getCustomFieldObject((Long) 11111)
def user = userManager.getUserByName("username")
if (issue.getCustomFiledValue(cf).equals("value")){
watcherManager.startWatching(user, issue)
}
Hi Ivan,
Thanks for your reply. My field is a select list (single choice). I guess this is why I'm getting this error?
Thanks,
Ovidiu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I see. Then the code should be as follows:
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.getUserManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
def cf = cfManager.getCustomFieldObject((Long) 11111)
def user = userManager.getUserByName("username")
if (issue.getCustomFiledValue(cf).getValue().equals("value")){
watcherManager.startWatching(user, issue)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
I'm getting the exact same error with this syntax.
The cf is defined as you mentioned and it doesn't give any errors:
def cf = cfManager.getCustomFieldObject((Long) 11403)
Thanks,
Ovidiu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's a typo on line 10.
Instead of:
issue.getCustomFiledValue(cf).getValue().equals("value")
it should be:
issue.getCustomFieldValue(cf).getValue().equals("value")
After that you can pretty much ignore other static type checking errors. It should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I assume you are trying this in a listener?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, didn't mention this part. Doing it as a post function as part of the create transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.