Being not so familiar with Scripting, I am trying to implement a Behaviour serverside script on a create issue screen to hide/show the custom fields depending upon the value of select list value.
I have tried the following script:
def Linkedissues = getFieldById("customfield_13310")
def Assignee = getFieldById("customfield_13310")
def Reporter = getFieldById("customfield_13310")
def Description = getFieldById("customfield_13310")
def Summary = getFieldById("customfield_13310")
def FixVersion = getFieldById("customfield_13310")
def ApproximateEffort = getFieldById("customfield_13609")
def Attachment = getFieldById("customfield_13310")
def RequirementImpact = getFieldById("customfield_14390")
def DecisionDueDate = getFieldById("customfield_14594")
def AffectedProducts = getFieldById("customfield_14040")
def AffectedConstellations = getFieldById("customfield_14595")
def AffectedCustomers = getFieldById("customfield_14596")
def RiskofDefect = getFieldById("customfield_14597")
def Action = getFieldById("customfield_14598")
def Reason = getFieldById("customfield_14599")
def Impact = getFieldById("customfield_14600")
def DocumentWorkInstructions = getFieldById("customfield_14601")
def Type = getFieldById("customfield_14593")
def selectedOption = Type.getValue() as String
log.debug "Selected option: $selectedOption"
if (selectedOption == "Defect")
{ Linkedissues.setHidden(false) Assignee.setHidden(false) Reporter.setHidden(false) Description.setHidden(false) Summary.setHidden(false) ApproximateEffort.setHidden(false) Attachment.setHidden(false) DecisionDueDate.setHidden(false) AffectedProducts.setHidden(false) AffectedConstellations.setHidden(false) AffectedCustomers.setHidden(false) RiskofDefect.setHidden(false) FixVersion.setHidden(false) }
else {
if(Linkedissues.value || Description.value || Summary.value || FixVersion.value || ApproximateEffort.value || Attachment.value || DecisionDueDate.value || AffectedProducts.value || AffectedConstellations.value || AffectedCustomers.value || RiskofDefect.value || FixVersion.value || Assignee.value || Reporter.value)
{ Linkedissues.setFormValue(null) Assignee.setFormValue(null) Reporter.setFormValue(null) Description.setFormValue(null) Summary.setFormValue(null) ApproximateEffort.setFormValue(null) Attachment.setFormValue(null) DecisionDueDate.setFormValue(null) AffectedProducts.setFormValue(null) AffectedConstellations.setFormValue(null) AffectedCustomers.setFormValue(null) RiskofDefect.setFormValue(null) FixVersion.setFormValue(null) }
Linkedissues.setHidden(true)
Assignee.setHidden(true)
Reporter.setHidden(true)
Description.setHidden(true)
Summary.setHidden(true)
ApproximateEffort.setHidden(true)
Attachment.setHidden(true)
DecisionDueDate.setHidden(true)
AffectedProducts.setHidden(true)
AffectedConstellations.setHidden(true)
AffectedCustomers.setHidden(true)
RiskofDefect.setHidden(true)
FixVersion.setHidden(true)
}
if (selectedOption == "Scope Change")
{ Linkedissues.setHidden(false) Assignee.setHidden(false) Reporter.setHidden(false) Description.setHidden(false) Summary.setHidden(false) ApproximateEffort.setHidden(false) Attachment.setHidden(false) DecisionDueDate.setHidden(false) Action.setHidden(false) Reason.setHidden(false) Impact.setHidden(false) }
else {
if(Linkedissues.value || Description.value || Summary.value || FixVersion.value || ApproximateEffort.value || Attachment.value || DecisionDueDate.value || Action.value || Reason.value || Impact.value || Assignee.value || Reporter.value)
{ Linkedissues.setFormValue(null) Assignee.setFormValue(null) Reporter.setFormValue(null) Description.setFormValue(null) Summary.setFormValue(null) ApproximateEffort.setFormValue(null) Attachment.setFormValue(null) DecisionDueDate.setFormValue(null) Action.setFormValue(null) Reason.setFormValue(null) Impact.setFormValue(null) FixVersion.setFormValue(null) }
Linkedissues.setHidden(true)
Assignee.setHidden(true)
Reporter.setHidden(true)
Description.setHidden(true)
Summary.setHidden(true)
ApproximateEffort.setHidden(true)
Attachment.setHidden(true)
DecisionDueDate.setHidden(true)
Action.setHidden(true)
Reason.setHidden(true)
Impact.setHidden(true)
FixVersion.setHidden(true)
}
if (selectedOption == "Process")
{ Linkedissues.setHidden(false) Assignee.setHidden(false) Reporter.setHidden(false) Description.setHidden(false) Summary.setHidden(false) ApproximateEffort.setHidden(false) Attachment.setHidden(false) DecisionDueDate.setHidden(false) DocumentWorkInstructions.setHidden(false) }
else {
if(Linkedissues.value || Description.value || Summary.value || FixVersion.value || ApproximateEffort.value || Attachment.value || DecisionDueDate.value || DocumentWorkInstructions.value || Assignee.value || Reporter.value)
{ Linkedissues.setFormValue(null) Assignee.setFormValue(null) Reporter.setFormValue(null) Description.setFormValue(null) Summary.setFormValue(null) ApproximateEffort.setFormValue(null) Attachment.setFormValue(null) DecisionDueDate.setFormValue(null) DocumentWorkInstructions.setFormValue(null) FixVersion.setFormValue(null) }
Linkedissues.setHidden(true)
Assignee.setHidden(true)
Reporter.setHidden(true)
Description.setHidden(true)
Summary.setHidden(true)
ApproximateEffort.setHidden(true)
Attachment.setHidden(true)
DecisionDueDate.setHidden(true)
DocumentWorkInstructions.setHidden(true)
FixVersion.setHidden(true)
}
I am not able to create issues, When I click on Create button , the screen freeze and it is taking infinite time...
I have tried the similar script on Edit screen and it worked fine, but for Create screen it is giving me an issue. Please can someone help me with this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.