Hi Team,
I would like to make these fields mandatory ( European Retailer, History/Format Change, Legacy Migration, TV2 Migration, TPD Document Type) when Product Type is "Data Engine" , here Product Type is select List (multiple Choices), I am using below script, but not able to make the fields mandatory. Could anyone please check and correct the script where i did miss it ?
def europeanField = getFieldByName("European Retailer")
def historyField = getFieldByName("History/Format Change")
def legacyField = getFieldByName("Legacy Migration")
def tv2Field = getFieldByName("TV2 Migration")
def tpddocField = getFieldByName("TPD Document Type")
def producttypeField = getFieldByName("Product Type")
def producttypeValue = producttypeField.getValue()
if (producttypeValue == "Data Engine")
{
europeanField.setRequired(true)
historyField.setRequired(true)
legacyField.setRequired(true)
tv2Field.setRequired(true)
tpddocField.setRequired(true)
}
else {
europeanField.setRequired(false)
historyField.setRequired(false)
legacyField.setRequired(false)
tv2Field.setRequired(false)
tpddocField.setRequired(false)
}
Thanks!
Thank you @Vikrant Yadav for your quick response.
I have corrected my code as per your doc and its working fine.
import com.onresolve.jira.groovy.user.FieldBehaviours
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.BaseScript
def europeanField = getFieldByName("European Retailer")
def historyField = getFieldByName("History/Format Change")
def legacyField = getFieldByName("Legacy Migration")
def tv2Field = getFieldByName("TV2 Migration")
def tpddocField = getFieldByName("TPD Document Type")
def producttypeField = getFieldByName("Product Type")
def producttypeValue = producttypeField.value as List
@BaseScript FieldBehaviours fieldBehaviours
def log = Logger.getLogger(getClass())
if (producttypeValue == ["Data Engine"])
{
europeanField.setRequired(true)
historyField.setRequired(true)
legacyField.setRequired(true)
tv2Field.setRequired(true)
tpddocField.setRequired(true)
}
else
{
europeanField.setRequired(false)
historyField.setRequired(false)
legacyField.setRequired(false)
tv2Field.setRequired(false)
tpddocField.setRequired(false)
}
Cool! Glad to hear it works for you :)