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

Make "Attachment" field conditionally required using Behavior

Pete P
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 16, 2023

I need to make "Attachment" a required field based on the value of a custom field.   When I set the Attachment as "required" in the field configuration page of the request type it does work.  However using behaviour it doesn't work.  It does toggle the "(Required)" text however.  In my application if the custom field Terraform is "YES" (12821),  I need attachment to be required. 

Here is my simple script:

 

def Terraform = getFieldByName("Terraform")
def Attachment = getFieldByName("Attachment")
   
def TerraformValue = Terraform.getFormValue();

if (TerraformValue !="12821") // Yes
{

    Attachment.setRequired(false)
}
else
{

    Attachment.setRequired(true)

}

1 answer

1 accepted

1 vote
Answer accepted
Mohamed Benziane
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 17, 2023
Pete P
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 17, 2023

Thanks @Mohamed Benziane ~

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.2.2
TAGS
AUG Leaders

Atlassian Community Events