Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner - assignement in workflow

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,

1 answer

Hi @Arthur SALMON , does john.doe have Assignable permission set?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.2
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you