Validator: how to test for 'Automatic'

vkopetzky April 5, 2019

I'm using a simple scripted validator to ensure the assignee is set.

Testing for Unassigned is selected by:

!(!issue.assignee)

How can I check if the field is set to "Automatic"?

 

Thanx a bunch!

2 answers

1 vote
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.
April 7, 2019

You can actually access what the user entered on the Transition screen using this code:

if (ActionContext.getParameters() != null) {
String[] assigneeSelected = (String[]) ActionContext.getParameters().get("assignee");
if (assigneeSelected != null && assigneeSelected.length > 0) {
selectedAssigneeName = assigneeSelected[0];
if (selectedAssigneeName.equals("-1")) {
// the user selected "automatic"
}
}
}
Peter-Dave Sheehan
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 8, 2019

Thanks for correcting my misconception. :)

0 votes
Peter-Dave Sheehan
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 5, 2019

By the time the issue is accessed by the validator, the assignee should be set either to the project lead or component lead based on the configuration.

I don't think it's possible to know if it was so because the reporter selected that user or it was automatically applied by the project/component configuration.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events