Hi Community, I need help on assigning group that is based on the value of single list select custom field
Scenario is
When I choose a value on single select list (i.e. I have Affected Service as the single select list, then I select Power as the value of it ) , a group will be assigned on that ticket., group will be assigned depending on the value that is selected on Affected Service Field.
Currently, I'm using this code to capture the Assignee Field based on the value selected on the Affected Service Field using ScriptRunner Post Function. Is it possible to reuse this code to capture the groups? group will be added on the ticket depending on the value selected. Thanks!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
String user;
def cfManager = ComponentAccessor.getCustomFieldManager();
def cf = cfManager.getCustomFieldObjectByName("Affected Service");
switch(issue.getCustomFieldValue(cf) as String){
case "Hardware": user = "jiraadmin";break;
case "Salesforce": user = "w00377";break;
case "Mashery": user = "sample";break;
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByKey(user))
Hi Alvin,
Can you please clarify with what you are saying about assigning a group to an issue? As Tarun mentioned, you can only set one person as the assignee, not a group. You could add all the users in the group as watchers. You could also have the post-function send a custom email to users in that group to notify them.
Regards,
Josh
Hi Joshua Yamdogo @ Adaptavist, I'm using it on Post Function. What I mean is when I select value on the Affected Service field, a group will tag on the ticket, lets say I have single group picker field with values Support1 Support2 Support3, If the value on Affected Service Field is Sample1 , then the group Support1 will be tag on the ticket. If Sample2, group Support2 and so on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Alvin
Where in Jira are you inserting the code? Are you using post-function or script listener?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also, you have mentioned
" Is it possible to reuse this code to capture the groups of the Assignee ? Thanks!"
You can use the group manager to fetch the groups of the assignee but in Jira you can assign the issue only to individual assignee and not groups.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tarun Sapra, I'm using it on Post Function. What I mean is when I select value on the Affected Service field, a group that is assign on that value will notified, and included on the ticket
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.