Hi,
I have a requirement, that when a jira ticket opens the default assignee will be related to the selected team.
So, if i set the field "team" when I create a new jira, (with team "X"), when it opens the jira assignee will be "John"
and for team "Y" the assignee will be "David"
I pretty new with Jira so if you can direct me specifically it will be great.
Thanks
Well, what you want sounds like the behaviour of the components Field. Instead of "Team" use Component "X" (with default assigee John) or use Component "Y"( with default assignee David).
Hello,
It is not possible out of the box. You would need develop a custom plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, thanks
this wouldn't help?
If so, where do I add this code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would help. You need to install Adaptivist ScriptRunner first. It is not a free add on. Then you would add a post function to the transition where you set your team field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, for some reason we cant make it work....
here is our post function:
---------------------------------------------------------------
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.MutableIssue
String userName;
def customFieldManager = ComponentAccessor.getCustomFieldManager()def team = customFieldManager.getCustomFieldObject("customfield_12801")def fieldValue = team.getValue(issue);
switch(fieldValue){ case "Jira Engage-Default": userName = "shaked";break; case "Jira Test": userName = "kobi";break; case "Jira Default": userName = "enir";break; }
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))
---------------------------------------------------------------
The custom field this script tries to access ( customfield_12801 ) , its a Group picker , so we need to get the value from this field, compare it to the text strings , and set the assigned accordingly.
can you please assist?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is that team.getValue(issue) returns List<Group> not a String. That is why you should write like this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.crowd.embedded.api.Group
String userName;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def team = customFieldManager.getCustomFieldObjectByName("customFieldName")
def fieldValue = team.getValue(issue);
switch(fieldValue?.get(0)?.getName()){ case "Jira Engage-Default": userName = "shaked";break; case "Jira Test": userName = "kobi";break; case "Jira Default": userName = "enir";break; }
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks very much!
This is the code I placed:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.crowd.embedded.api.GroupString userName;def customFieldManager = ComponentAccessor.getCustomFieldManager()def team = customFieldManager.getCustomFieldObject("customfield_12801")def fieldValue = team.getValue(issue);
switch(fieldValue?.get(0)?.getName()){ case "Jira Engage-Default": userName = "shaked";break; case "Jira Test": userName = "kobi";break; case "Jira Default": userName = "enir";break; }issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName))
and this is the error I get:
What do we do wrong?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is just a static compilation error. Do not pay attention to it, it will work just fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks @Alexey Matveev very much.
We have a progress...
But we see that after using the code above, the Jira ticket is opened but the assignee is not the requested/set in code.
we see a weired behavior:
1)the assignee in the Jira ticket itself is not the requested assignee as in the script but it set assignne "unassigned" or the default assignee of the Jira project.
2)the assignee in the created issue mail notification from Jira (from the same jira ticket) is the requested from the script.
see screen shots:
1)The Jira ticket itself- has assignee "unassigned"
2)The assignee in the email notification from Jira )for the same ticket), is the right assignee as in the script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where do you put the script?
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.
Here is the script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.crowd.embedded.api.Group
String userName;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def team = customFieldManager.getCustomFieldObject("customfield_12801")
def fieldValue = team.getValue(issue);
switch(fieldValue?.get(0)?.getName())
{
case "Jira Engage-Default": userName = "shaked"; break;
case "Jira Engage-Widgets-Cats": userName = "nalook"; break;
case "Jira Organic campaigns": userName = "tmagen" ;break;
case "Jira Engage Reports": userName = "vioffe" ;break;
case "Jira organic recs": userName = "itamir" ;break;
case "Jira Amplify- Default": userName = "zbarak" ;break;
case "Jira Amplify-API-Buyers": userName = "nfriedrich" ;break;
case "Jira Amplify-Pics-Pixels-Impressions-Clicks-Segments": userName = "amatar" ;break;
case "Jira Amplify-Dashboard-Selfserve": userName = "ngeva" ;break;
case "Jira paid recs": userName = "drosenstein" ;break;
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Put this script before Number 2 Re-index an issue to keep indexes in sync with the database
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I moved it, and still the same behavior... (email OK, ticket wrong assignee), any other thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok. It must be number 2. It is ok. add the last line to the script
issue.store()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you mean like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.crowd.embedded.api.Group
String userName;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def team = customFieldManager.getCustomFieldObject("customfield_12801")
def fieldValue = team.getValue(issue);
switch(fieldValue?.get(0)?.getName())
{
case "Jira Engage-Default": userName = "shaked"; break;
case "Jira Engage-Widgets-Cats": userName = "nalook"; break;
case "Jira Organic campaigns": userName = "tmagen" ;break;
case "Jira Engage Reports": userName = "vioffe" ;break;
case "Jira organic recs": userName = "itamir" ;break;
case "Jira Amplify- Default": userName = "zbarak" ;break;
case "Jira Amplify-API-Buyers": userName = "nfriedrich" ;break;
case "Jira Amplify-Pics-Pixels-Impressions-Clicks-Segments": userName = "amatar" ;break;
case "Jira Amplify-Dashboard-Selfserve": userName = "ngeva" ;break;
case "Jira paid recs": userName = "drosenstein" ;break;
}
issue.setAssignee(ComponentAccessor.getUserManager().getUserByName(userName));
issue.store()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that is what I mean
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.