Groovy MissingPropertyException for CustomField

I have 2 if conditions and within them I define custom fields to update the values. However, within the second if block the following line generate a MissingPropertyException error.

CustomField uploadStatus = customFieldManager.getCustomFieldObjectByName("Upload Status");

The error:

The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: customFieldManager for class: Script79

If I defined the above line outside of the if-block there are no errors (I can also successfully print the value). What I find odd is I have the same line defined within the first if-block which works fine.

Unsure if this is useful but I've define the following outside of the if conditions:

ComponentManager componentManager = ComponentManager.getInstance();
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();

Fairly new to this so let me know if further information is required, thanks.

1 answer

This widget could not be displayed.
Rina Nir Solutions Partner Jul 27, 2014

Can you provide the complete code (including the definitions, if blocks, and whatever is between them)? Best perhaps is to create the simplest code that still reproduces the error message.

Thanks. I found the issue to be where the code was sitting. I have fixed it now and the error is not longer present.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

510 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you