Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Making fields mandatory during workflow transition but based on some conditions

Hello,

I want to make the following fields mandatory  when bug is moved from In Progress to 'Fixed' or 'To Deploy'

Fields to be made mandatory - '1st stage of injection, Dev RCA, Dev Preventive Action, Root Cause Release

Condition when it has to be made mandatory - 

Established Root Cause is 'Design' or 'Development' or 'Same root cause' or 'Requirements' AND
Detected in Test Stage IN (5-Warranty or 7-Prod) AND
Application IN ("AAA", "BBB", "CCC")

I wrote the below code and placed it in the 'Validators' sections during the transition In Progress to Fixed. But nothing seems to be happening. can someone tell me what is wrong? 

 

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueFactory
import com.atlassian.jira.project.ProjectManager
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import java.util.ArrayList;
import groovy.transform.BaseScript
import java.lang.Object;
@BaseScript FieldBehaviours fieldBehaviours
FormField rootCause = getFieldById("customfield_18311")
FormField testStage = getFieldById("customfield_18308")
FormField application = getFieldById("customfield_18323")
FormField injectionStage = getFieldById("customfield_18400")
FormField preventiveAction = getFieldById("customfield_18401")
FormField devRCA = getFieldById("customfield_18408")
FormField rootCauseRel = getFieldById("customfield_18328")

if ((rootCause.getValue() == "Design" || rootCause.getValue() == "Development" || rootCause.getValue() == "Requirements"|| rootCause.getValue() == "Same root cause") &&

(testStage.getValue() == "5-Warranty" || testStage.getValue() == "7-PROD") &&

(application.getValue() == "MCOM" || application.getValue() == "OES" || application.getValue() == "NPS"|| application.getValue() == "PNI"|| application.getValue() == "WWS" ||
application.getValue() == "WSL" || application.getValue() == "COB" || application.getValue() == "COB-RT" || application.getValue() == "BOL" || application.getValue() == "CACS" ||
application.getValue() == "CBP" || application.getValue() == "SHE" || application.getValue() == "AIA" || application.getValue() == "MIB" || application.getValue() == "MIBA" ||
application.getValue() == "PTE" || application.getValue() == "PTEPLUS" || application.getValue() == " ARE" || application.getValue() == " AREPL" || application.getValue() == "CTE" ||
application.getValue() == "OHE" || application.getValue() == "IPAP" || application.getValue() == "ISIS"))
{injectionStage.setRequired(true)
preventiveAction.setRequired(true)
devRCA.setRequired(true)
rootCauseRel.setRequired(true)
}
else
{injectionStage.setRequired(false)
preventiveAction.setRequired(false)
devRCA.setRequired(false)
rootCauseRel.setRequired(false)
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

44 views 0 1
Read article

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