Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

changing system select field value to set other custom fields as required in jira using behaviour

Ravi Kanth
Contributor
January 13, 2022 edited

selecting a single value in system select field-"Resolution" have to set multiple custom fields as required..

selecting a single value in custom select fields "Defect Category" have to set multiple system fields as required.. are working but not the vice versa

CustomFields

  • Defect Category
  • Technical Cause Resolution Issue.PNG

 

1 answer

1 accepted

1 vote
Answer accepted
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2022

Hi @Ravi Kanth For setting custom field Defect Category and Technical Cause mandatory based on Resolution system field. For this you have to apply Server side script on Resolution field and apply the following script. Kindly change field id and Resolution name in If/else statement. 

hope it works for you!

import com.atlassian.jira.issue.resolution.Resolution

def resolutionField = getFieldById("resolution")
def fixVersionsField = getFieldById("fixVersions")
def defect = getFieldById("customfield_12345")
def technical = getFieldById("customfield_78910")


def resolution = resolutionField.getValue() as Resolution

if (resolution.name == "Fixed") {
fixVersionsField.setRequired(true)
defect.setHidden(false)
technical.setHidden(false)
} else {
fixVersionsField.setRequired(false)
defect.setHidden(false)
technical.setHidden(false)
}

 Thanks

V.Y

Ravi Kanth
Contributor
January 13, 2022

Hi@Vikrant Yadav ,

Thank u soo much...
the code works  but when reverting back the selection to "Please Select.." custom Field still remains as mandatory.Resolution-Issue.PNG

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2022

@Ravi Kanth May i know Please Select is a value you added to Resolution field ? If Yes, try to add "Please select.." in else statement. 

else if (resolution.name == "Please select.." ) {
defect.setRequired(false)
technical.setHidden(false)
}

 Usually Default value comes for mandatory Resolution field.It seems that you added Please Select... value in Resolution. 

Let me know, how it works.

Thanks

V.Y

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Upcoming Apps & Integrations Events