Hi Team,
I have requirement to assign the jria ticket depends on the selection list. Could you please suggest that how to implement this ?
Example , we have Department field with single selection list
If user selects Technology while creating the jria ticket , it should assign the jira ticket to abc@xxx.com, if user selects Marketing/Sales, it should assign the jira ticket to aabc@xxx.com, etc
Thanks!
Hi @Lakshmi CH
with JMWE, you can simply use a Set Field Value post-function on the Create transition, with a value (of type "Groovy Expression") like:
switch (issue.get("Department")) {
case "Technology": return "usera";
case "Marketing/Sales": return "userb";
default: return null; //others are unassigned
//etc
}
Note that usera, userb, etc. must be Jira usernames, i.e. what the user uses for their login (which might be different from their email address)
Hello @Lakshmi CH
This use case can be accomplished by the use of Automation with a simple If-Else construct. This can be customised to impact a particular issue type as well.
Please let me know if you need guidance on the Automation rule.
Kindly accept the answer if this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Gaurav
Thanks for the quick reply. We have JSU, JMWE and Script runner. Can we accomplish with those addons ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Lakshmi CH
Yes, these plugins can help you to accomplish this. Kindly accept the answer if this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The below code is working as expected. Assign the ticket to particular user based on single selection field value.
-------------------------------------------------
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
import org.apache.log4j.Level
log.setLevel(Level.DEBUG)
log.debug "Starting postfunction..."
if (issue.isSubTask()) {
log.debug "Issue is subtask, leaving."
return
}
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfCategory = customFieldManager.getCustomFieldObjectByName("Department List")
log.debug "Found customfield ${cfCategory}."
def category = (issue?.getCustomFieldValue(cfCategory) as Option)?.value
log.debug "Got category ${category}."
def userToReassign = issue.getAssignee()
log.debug "Got assignee ${userToReassign}."
def userManager = ComponentAccessor.getUserManager()
switch (category) {
case "Technology":
log.debug "Getting user for Desktop category."
userToReassign = userManager.getUserByKey("abc@abc.com")
break
case "Marketing/Sales":
log.debug "Getting user for Network category."
userToReassign = userManager.getUserByKey("xyz@abc.com")
break
}
log.debug "Setting user to ${userToReassign}."
issue.setAssignee(userToReassign)
-----------------------------------------------
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.