Change Default Assignee for Jira with multiple Projects using the same workflow.

Jeff Stack November 16, 2020

Our Jira has multiple Projects using the same workflow.  Some of the Projects don't want to use the Project Lead as the Default Assignee.  How can I add a post function to change the Default Assignee from the Project Lead to a Developer based on the value of the Project field?  I tried to create a post function using "Assign to role member (JMWE app)", selected "Project Role = Developers", selected "Only if condition is true" but I'm lost after that.  Not sure how to proceed.  Can someone help?  I'm basically trying to perform:

If Project = "ABCDEF"
then Assignee = Developer
else Assignee = default

Thx,
Jeff

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2020

Hi Jeff,

I can try to help you but I first need some clarification.

When you say that, for certain projects, you want to assign the issue upon creation to a "Developer", what do you mean by that? Any member of the Developer project role (chosen pseudo-randomly)? A particular developer for each project?

And for the other projects, who should be the assignee (i.e., what should the "default" be)?

Jeff Stack November 16, 2020

Hi David,

By Developer I mean the Developer assigned in "Users and Roles" in "Project Settings" for a particular Project.  I realize there could be more than one Developer but I only plan on assigning one Developer to Projects that don't want the Project Lead as the default assignee.  I wish there was an additional option to select a default assignee other than the Project Lead. :-(

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2020

See Kat's answer below. Wouldn't that work for you? If not, you can certainly use the Assign to Role Member post-function with a conditional execution script like:

issue.get("project").key in ["ABCDEF","GHIJK"]

which will override the assignee. However, you might need to move the post-function to after the "Create the issue originally" post-function or Jira will override the post-function. 

Jeff Stack November 16, 2020

Thanks David.  That did the trick!

Jeff Stack February 23, 2021

Hi David.  I received a second request to set the Default Assignee, in my case the Default Assignee2 role, only if the Issue Type = Bug.  My current post process function which works great is (and thank you again for this):

      Assign the issue to the default user from the Default Assignee2 role.
      Run this post-function only if the following condition is true:
            issue.get("project").key in ["Project1"]

I tried adding this to set the Default Assignee2 role only if the Issue Type = Bug:

      Assign the issue to the default user from the Default Assignee2 role.
      Run this post-function only if the following condition is true:
            issue.get("project").key in ["Project1"] and issue.get("issuetype").key in ["Bug"]

This does not work though.  I tried a number of different formats to get it to run using Issue Type but have not had any success.

You're guidance on this would be greatly appreciated.

Also, is there a good wiki on using these conditional execution statements in Post Processes?  I haven't been able to find any good documentation so far.

Thanks.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2021

Hi Jeff,

JMWE uses the Groovy language as its scripting language, therefore the "logical and" operator is written as &&. Also, .key will return the "key" of an object - here you seem to want to test the name instead. Try this:

issue.get("project").name in ["Project1"] && issue.get("issuetype").name in ["Bug"]

As for documentation, you could start with this: https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/133562414/Customizing+further+with+Groovy+scripts and in particular https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/151191769/Groovy+tutorial

Jeff Stack March 23, 2021

Once again David Fischer, thank you for your help!  This works perfectly.

0 votes
Kat Warner
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 16, 2020

The setting that controls the default assignee is not held in the workflow. Check out the Roles section of the project settings. You can chose the relevant default assignee for each project without impacting the workflow or needing a post function.

Jeff Stack November 16, 2020

Hi Kat. 

Unless I'm missing something, Jira only allows the Project Lead to be the Default Assignee.  Otherwise you have to set the Default Assignee to "Unassigned". 

As I mentioned in my question, we want to be able to set someone other than the Project Lead as the default assignee based on Projects that use the same workflow.  I don't see any way to do that through "User and roles" in "Project settings".

Suggest an answer

Log in or Sign up to answer