hi ,
i need to set the default assignee based on the custom field value . could you please help on this .
ex:
custom field value contains :a,b,c,d
if a choose need to assign to the user a in the same post function
if i choose b then need to change as b user .
here we are using a single issue to look at various teams . so we have to move the tickets with the internal status as custom field value . pls help on this .
we will allocate to the user based on the field value only .
Thanks in advance .
Community moderators have prevented the ability to post new answers.
First of all, I hope you are using a User Picker custom field having a,b,c and d values. However, you can try this following step.
In the workflow post function, you will get a built-in post function 'Copy custom field values', if you have script runner plugin. Here, you can provide the source field and target field for copying the values.
Hi Mahesh,
i am having the custom field value with team names .
if i choose team a then need to set to some user in the post function
if i choose team b then need to set to different user by using the post function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If it is possible with script runner pls suggest the methods how to assign the issue based on the custom field value .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try this script and let me know the results. Sorry, I couldn't test and provide you, since I am away from my work station.
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.comments.CommentManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.util.ImportUtils import com.atlassian.jira.user.util.DefaultUserManager import com.atlassian.crowd.embedded.api.User userManager = (UserManager) ComponentAccessor.getUserManager() MutableIssue issue = issue IssueManager issueManager = ComponentAccessor.getIssueManager() CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager() CustomField mycustomfield = customFieldManager.getCustomFieldObjectByName("customfield_Name") String mycustomfieldValue = (String) issue.getCustomFieldValue(mycustomfield) if(mycustomfieldValue != null) { if(mycustomfieldValue.equals("a")){ User usera = userManager.getUser('userABC') issue.setAssignee(usera) } if(mycustomfieldValue.equals("b")){ User userb = userManager.getUser('userXYZ') issue.setAssignee(userb) } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi thanks mahesh ..
shall i need to paste this script in the post function directly or else..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, you can use this script directly by making these changes,
customFieldManager.getCustomFieldObjectByName(
"customfield_Name"
) - Replace "customfield_Name" with your customfield name.
mycustomfieldValue.equals(
"a"
) -
Here, "a" is your first value of customfield.
User usera = userManager.getUser(
'userABC'
) - Here, 'userABC' is your new assignee value.
Similarly add the other values as well, in respective if loops.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So close! When I copy this script to my post-function
I get two errors:
:
2. "unable to resolve class IssueManager" for this line:
IssueManager issueManager = ComponentAccessor.getIssueManager()
Any ideas?
Thank you.
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.