It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validator check on Create transition that assignee should not be empty. Edited

Mohit Dhir Community Leader Nov 18, 2019

Hi,

 

I wanted to make the assignee mandatory for one of the project-issuetype. I have thought on the below.

 

  • I can not change the global settings as this is only for 1 project-issuetype.
  • We can not make the assignee field mandatory in the field configuration. ( not allowed in Jira).
  • I have script runner and tried the simple scripted Validator but it does not seems to work 

          if ( issue.assignee.name == null )
          {
              return false
          }

         Tried the below as well. 

         if (issue.getAssignee() == null)
         {
              return false
         }

 

I got to understand that many thing come sinto the effect once the issue is created however validators are to check before the issue is created. 

 

Could anyone suggest a method using which I can access the create form elements and validate it.

2 answers

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader Nov 19, 2019

Hi @Mohit Dhir ,

Your method is correct, please try this script : 

import com.opensymphony.workflow.InvalidInputException

if (!issue.getAssignee()){
invalidInputException = new InvalidInputException("Assignee cannot be empty.")
throw invalidInputException
}

Antoine

Mohit Dhir Community Leader Nov 20, 2019

Hi @Antoine Berry 

Thanks for your help. Now I understand that it needs to be an exception to terminate. 

it worked thanks. 

Like Antoine Berry likes this
0 votes
Mohit Dhir Community Leader Nov 18, 2019

Tried the below as well. Same no effect

if (issue.getAssignee() == null)
{
return false
}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you