How do i get the default assignee for an issue for a postfunction in scriptrunner.
In the script i set the component in depence on the isuetype.
I want to set the assignee but how do i get the "real" default assignee.
This can be set in the components of the project settings (component-lead, project-lead or project-default).
ProjectLead: issue.getProjectObject().projectLead
ComponentLead: componentForProject.getLead()
How do i get the assignee for the component/project-configuration?
Thanks, michael
Hi Michael,
Check out https://scriptrunner.adaptavist.com/latest/jira/behaviours-api-quickref.html. It looks like the following may get you what you need:
getFieldById("customfield_11111")
getFieldById("summary")
getFieldByName("My Custom Field")
getFieldByName("Description")
You may also want to check out https://community.atlassian.com/t5/Jira-questions/How-to-get-issue-assignee-using-scriptrunner/qaq-p/703203. Cheers!
Thanks Joshua, but this is not what i am searching for.
I look for a way to find the default assignee depend on the project settings for components.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
My apologies, It's fairly apparent when read again. It doesn't look like this is an easy find. You may want to look into AssigneeTypes in the Java API. Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow, great. Thank you Joshua, i never know something about AssigneeTypes.
It worked partly. Do you maybe know where i con get the "Project Default"?
In the configuration for the component i can set projectdefault and this is configured under the roles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, i found it by myself :)
For those who are interested in the solution.
It is a postfunction in the process of creation:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.AssigneeTypes
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def componentsForProject = projectComponentManager.findAllForProject(issue.projectId)
for (componentForProject in componentsForProject) {
if (componentForProject.name.equals('DB-Tool')) {
issue.setComponent([componentForProject])
switch(componentForProject.assigneeType) {
case AssigneeTypes.COMPONENT_LEAD:
issue.assignee = componentForProject.componentLead
break
case AssigneeTypes.PROJECT_LEAD:
issue.assignee = issue.projectObject.getProjectLead()
break
case AssigneeTypes.PROJECT_DEFAULT:
switch(issue.projectObject.assigneeType) {
case AssigneeTypes.PROJECT_LEAD:
issue.assignee = issue.projectObject.getProjectLead()
}
}
break
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael, this helps me too. Though what happens if there is no component specified? I can find the project lead, but in the case where the project level setting for 'default assignee' is set to 'unassigned', how can that be captured, so as to set it accordingly? Did you solve for that too?
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.