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

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 Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,149 views 6 19
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot