Hello,
I use JIRA Server v7.12.3.
For a specific issue type (bug) workflow,
I'd like to assign an issue to component lead on initial issue creation. But there are 2 conditions:
1. For some components it is ok to assign component lead.
2. However, for some components I'd like to assign one single user. (This user is not a component lead - here is the problem)
How can I do that by using post function on workflow transition configuration (ex: via Custom Script Post-Function) If script runner is the only way, could you please assist to write it in a simple way?
P.S: I do not want to do this auto-assignment operation by only using Component Lead function. Because it executes for all issue types. I'd like to do for a specific issue type workflow.
Thanks in advance!
Hi @Sedanur Ozturk and welcome to the Community! Have you thought about using an automation rule rather than a post-function script?
Hi @Laurie Sciutti , thank you for welcoming :)
I'm not system admin and need to run some procedures for adding Automation app. And I'm not sure if this app is compatible or not. So that'd be the last option for me for now.
Thanks indeed!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sedanur Ozturk - welcome to the community,
should be possible with a custom script in post function. Does the issue type you would like to apply this have its own workflow? Or is it a shared workflow for several issue types?
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See a first pitch of such a script below. This is just a draft for you to figure out the elements and steps that could lead to your solution.
Furthermore I always took the first component (as an issue could possible consist of more than 1 components).
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getComponent(IssueManager)
def cfManager = ComponentAccessor.getComponent(CustomFieldManager)
def leadUser = issue.components.getAt(0).lead
def issueComponent = issue.components.getAt(0)
log.warn issue.issueTypeId.equals("10000")
log.warn issue.components.getAt(0).name
if (issue.issueTypeId.equals("10000")) { // -- > ID of issueType - you need to change to the ID of your issueType
if(issueComponent.name.equals("Component 1")){
issue.setAssignee("<any user you want, either component lead or other ApplicationUserObject>")
log.warn "juhuuu"
}
else if(issueComponent.name.equals("anyOtherComponent")){
log.warn "here you go"
}
else{
log.warn "nothing happens"
}
}
issueManager.updateIssue(Users.loggedInUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
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.