Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot create issue after running the behavior script

Jyoti Karwal April 16, 2018 edited

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.

1 answer

0 votes
Jyoti Karwal April 18, 2018

Can any one help please?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events