How to change assignee? Jira on premise to Jira Cloud

Originally asked by Filip Š. on 20 April 2021 (original question)


Hello,

I’m getting sync from Jira on premise site, to Jira Cloud site.

I would like to set assignee on project lead, but only if assignee on the other side is set to a specific user, let’s say “USER 1”.

Can you please provide help?


Answer by Francis Martens (Exalate) on 21 April 2021

You want to set the issue.assignee to issue.project.lead when the remote assignee is set to “USER 1”?

Use following snippet

if (replica.assignee.displayName == "USER 1") {
   issue.assignee = issue.project.lead
}

Comments:

Filip Š. commented on 21 April 2021

Hi Francis,

I’m working on cloud side, and this part

issue.assignee = issue.project.lead is not working for me.  
  
Can you please take a look at this.
Francis Martens (Exalate) commented on 21 April 2021

is not working for me.’ is really not sufficient as a statement.

Please try to understand what is not working and provide more details.

Filip Š. commented on 22 April 2021

Ok, thank you for understanding.

issue.assige = issue.project.lead - this part is not working, it does not set a right person. As a matter of fact, it doesn’t set anyone.

When I use this code instead “issue.assignee = nodeHelper.getUserByEmail(“test@test.com”)” it is working and it does set me the assignee with this adress.

Do you understand me now?

Kr,

Filip

Francis Martens (Exalate) commented on 22 April 2021

So - did you look if issue.project.lead has a value?

Use a debug statement to inspect

something like

debug.error("project lead = ${issue.project.lead}")