Unable to clear Asset referenced custom field

Anusha Wilson March 12, 2025

I have a Asset and a Asset referenced field in a screen. The Asset referenced field lists values based on the Asset field. I am trying to clear the Asset referenced field whenever the Asset field is changed, so that users can select values for the Asset referenced field. I used the below behaviour script. But the value doesnt get cleared. Any help on this is appreciated. Thanks!

 

def category = getFieldById("customfield_27000");
def subcategory = getFieldById("customfield_27002");
def selectedCategory = category.getValue();

def myField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects().findByName("Category_A")
def fieldValue = underlyingIssue?.getCustomFieldValue(myField).toString()
def is_retained = fieldValue.contains(selectedCategory.toString())
if(fieldScreen.name.toString().contains("Edit"))
{
if(!is_retained)
{
    subcategory.setFormValue("")
  
}
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events