Need help with modifying script for including TEST issue type for a field validation

Aisha M August 7, 2019

Hi,

I have used the below script for ensuring Fix Version field is filled while moving an issue from READY TO ACCEPT to ACCEPTED status

def fixVersions = issue.getFixVersions();
if (fixVersions == null || fixVersions.isEmpty())
{
errors.add("Fix Version is required to accept this ${issueType}")
}

 How do I make this script to include TEST issue types as well. Please help. Thank you 

1 answer

1 accepted

1 vote
Answer accepted
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2019

Hi @Aisha M ,

You can use this line to check issue type id.

if(issue.getIssueTypeId().equals("10000")){
//
}

Regards

Aisha M August 7, 2019

@Tansu Akdeniz  Thank you for the comment;

I know the issue type ID. Can you please help me with how to ensure that Fix Version is filled in while moving a TEST issue type from one status to another. In my case, READY TO ACCEPT to ACCEPTED

Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2019

In the workflow, you need to put this validator to READY TO ACCEPT to ACCEPTED transition in order to make fix version required for test issuetype.

import com.opensymphony.workflow.InvalidInputException;

if(issue.getIssueTypeId().equals("10000")){ //TEST issue type id
def fixVersions = issue.getFixVersions();
if (fixVersions == null || fixVersions.isEmpty())
{
invalidInputException = new InvalidInputException("Fix Version is required to accept it");
}
}
Aisha M August 8, 2019

@Tansu Akdeniz  Thank you. Will check it out.

Also, do I need to add the inclusion to the existing code ? Or add a new one.

The reason is because, by usual all our other issue types go through this process and Fix Version is mandatory for moving the issue to the ACCEPTED status. So, want ot make sure the other issue types don't get affected

Suggest an answer

Log in or Sign up to answer