Set the "project lead" as an assignee

Originally asked by Sujan Karanjeet on 20 November 2019 (original question)


Hi,

I’m looking for for a solution to get the “Project Lead” of the project in exalate.

issue.assignee = nodeHelper.getUserByUsername(“User1”) would return a specific user to the assignee field.

However, I would like to have the main “Project Lead” or the default assignee to be the assignee while an issue is created in Jira with exalate.

May be something like: issue.assignee = nodeHelper.getProjectLead(“…”).

BR,

Sujan


Answer by Francis Martens (Exalate) on 20 November 2019

The project field has the lead as attribute

https://docs.idalko.com/exalate/display/ED/Project

What you can do is

issue.assignee = issue.project.lead

But watch out. During first sync, issue.project is unknown (because at that stage the project is not set)

To guard against this - you should use the nodeHelper to lookup the project, and then extract the lead

issue.assignee = nodeHelper.getProject(issue.projectKey)?.lead


Let me know if this helps

Francis