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)
}