Hi Community,
I have scripts which are assigning users based on custom field values.
Those scripts are working and assigning the user but, for some reason, I have some users which are not correctly assigned and I don't know why.
For example, based on this script :
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;
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.event.type.EventDispatchOption
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.user.UserUtils;
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
def String m_assignee = 'Unassigned';
def cfIssueType = issue.issueType.name;
if(cfIssueType == "Task"){
def cfEntity = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Entity");
def cfEntitySwitch = issue.getCustomFieldValue(cfEntity) as LazyLoadedOption
switch(cfEntitySwitch){
case 'France':
m_assignee = 'john.doe';
break;
case 'US':
m_assignee = 'jack.jones';
break;
default:
m_assignee = 'john.smith';
break;
}
}
issue.setAssigneeId(m_assignee);
In that script, users jack.jones and john.smith will be assigned replacing their username by the full name but for john.doe it's still the username which is display in the assignee field and because of that, the user is not notified and cannot execute the actions relatives to is assignee role.
Any idea why I have that ?
Thanks in advance,
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.