Get the value of a custom field

Vishal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2020

Hello Team,

I have two custom fields which are visible & required only in one of the issue type of a project, in rest all issue type it's not required. I am doing it using behavior.

Now there is further requirement where in, if the value of first custom field which is single select type is "Yes", second custom field which is of number of attachment type should be made required.

I am running a server side script as below, but its not working. Can someone help with it ?

def approval = getFieldById("customfield_xxxxx")

approval.setHidden(true);

def attachment = getFieldById("customfield_xxxxx")

attachment.setHidden(true);
String issueType = getIssueContext().getIssueType().getName()

if (issueType == "New Request") {

approval.setHidden(false);

approval.setRequired(true);   

if ("Yes" in approval.value) {

attachment.setHidden(false);

attachment.setRequired(true); }

}

 

1 answer

1 accepted

0 votes
Answer accepted
Vishal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2020

Hello Guys, does anyone have any solution to this ?

Vishal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2020

The code is fine, something was wrong with the custom field, deleted a field & created new one & it works.

Suggest an answer

Log in or Sign up to answer