Assigning using a post function does not assign properly


I've created a post script function in a transition for automated assignment.

The script is post function is followed by the standard store and indexing functions.

This works sometimes fine, sometimes not.

First the script:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption

def versionManager = ComponentAccessor.getVersionManager()
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def Betreft = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Vraagcategorie")) as Map
def Hoofdcategorie = Betreft.get(null) as LazyLoadedOption
def Subcategorie = Betreft.get("1") as LazyLoadedOption
def Regio = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("(Informatie) Regio")) as LazyLoadedOption
def Afwijking = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Melding afwijking")) as LazyLoadedOption

if (Afwijking.getValue()=="X" ) {

} else if (Subcategorie.getValue()=="Y" ) {

} else if (Subcategorie.getValue()=="Z" && Regio==null ) {
} else if (Subcategorie.getValue()=="Z" && Regio.getValue()=="1" ) {
} else if (Subcategorie.getValue()=="Z" && Regio.getValue()=="2" ) {
} else if (Subcategorie.getValue()=="Z" && Regio.getValue()=="3" ) {
} else if (Subcategorie.getValue()=="Z" && Regio.getValue()=="4" ) {

} else {


The strange thing is that with userx and usery the assignee is set to the user asked.

For the other users, the assignee is filled but seen as not set.

When I open the issue, the user seems set but the picto is a question.

When entering the name the assignment is set.

I've no idea whats the difference between the users.

All are assignable.

All have logged in once.

All have the same permissions.

I've no clue



2 answers

1 accepted

0 votes
Accepted answer

Hi Arco,

I would suggest to use 

def user = ComponentAccessor.getUserManager().getUserByName("username")

instead of assigneeId.

Second thing, you should make sure that the post function is the first one or at least before the "Update change history for an issue and store the issue in the database." step.

regards, Thanos

Yesss! That did the trick. The first part, defining 'user'.

Still don't understand why setAssigneeID works inconsequent, but thats not my problem any more!

Thank you very much! Made my day!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

239 views 6 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you