Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script Runner set Assignee via post-function not working

Joe Red
Contributor
October 13, 2020

I am running this as a post-function via ScriptRunner but it is not setting the assignee for some reason:

if(issue.assignee == null){
     issue.setAssignee(issue.reporter)
     log.info("post assignee " + issue.assignee)
}

 

My log output comes back with 'post assignee THE RIGHT VALUE', but it is not reflected in Jira when I open the issue. 

This seems so simple but not working, any help would be greatly appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 13, 2020

Hi @Joe Red ,

What is this post-function used for? Are you trying to set issue reporter as assignee? If so, can you try this

 

if(issue.assignee == null)

{ issue.assignee=issue.reporter

log.info("post assignee " + issue.assignee)

}

Joe Red
Contributor
October 13, 2020

@Niranjan  that is working in the post-function but then it does not reflect that in the task when I go to it in Jira.

I am trying to set the assignee to the reporter if an assignee isn't selected upon ticket creation.

I have 2 post-functions after this in the workflow, could that have anything to do with it?

image.png

Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 13, 2020

Hi @Joe Red ,

The script is working for me as expected.

if(issue.assignee == null)

{ issue.assignee=issue.reporter

}

I do not think that the other two functions are causing the issue. Can you check the logs while making this transition?

0 votes
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2020

Hi @Joe Red,

Are you configured in create transition or in different transition?

can you provide screen shot of your post-function order. also check whether reporter is having valid permission to be as a assignee of the ticket

 

BR,

Leo 

Joe Red
Contributor
October 15, 2020

@Leo 

It looks like I was making the change in a different workflow.

Although it was executing and I could see the stats on each execution of the post-function.

When I put the post-function into another workflow, it worked as designed.

Thank you @Niranjan for the assist.

Like • Niranjan likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.11
TAGS
AUG Leaders

Atlassian Community Events