Jira Server Groovy: Check if issue was assigned via "Automatic" assignee

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2023

Hi all!

I'm trying to figure out during the issue creation screen, if the assignee field is:

  1. Automatic
  2. Unassigned
  3. Assigned

In any case, I have a script which needs to run only if an issue during creation has not an assignee (the reporter already placed/has chosen an assignee). So if the issue has on the assignee field the values "automatic" or "unassigned", then the script should run.

Keep in mind that automatic will assign the issues to the component leads or project default, based on the project configuration.

So far, I've played with transientVars which returns the modifiedValues only if the script was placed AFTER the issue create PF.

  • Inside the modified values when the issue had "automatic" as an assignee, the oldValue was null, whereas the newValue was the component lead.  <-- This is NOT OK
  • This was the same if the issue was assigned manually.  <-- This is OK
  • Only when the issue was unassigned, both values returned null. <-- This is OK

 

The only solution I've come up with is to create a behavior script, which will populate a CF with a value, is the assignee is a user. And then on my PF script I would check if that field is null or not. If it's null, then the script should run. 

Appreciate any advice on this matter :)

Thanx!

1 answer

1 accepted

2 votes
Answer accepted
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2023

Edit 2: Found the solution:

ActionContext.getRequest().getParameter("assignee") will return -1 if automatic is chosen on assignee. The trick is to place the PF before the create issue post function.

Dave Liao
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2023

Woohoo!

Dave Liao
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 1, 2023

...that's a gem!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events