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

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

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

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

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

@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
Community showcase
Published in Apps & Integrations

How we use Jira Service Management for our recruitment process! - Part 2

It is never about setting up a process and being done with it. Rather, the focus should always be on optimizing it for the best outcomes. Thus, we didn’t stop at setting up JSM for our recruitment pr...

194 views 0 5
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