Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get property 'value' on null object

Roy Chapman
Contributor
July 8, 2015

In the jira Catalina.out log files there are many (1.75m) errors like this associated with the 'Estimated Cost' scripted field.

 2015-07-06 12:32:03,650 NodeReindexServiceThread:thread-1 ERROR      [onresolve.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: XI-132, field: Estimated Cost

java.lang.NullPointerException: Cannot get property 'value' on null object

      at Script1.run(Script1.groovy:1)

 

The script is:

def templateType = getCustomFieldValue("Template Type").value;

def multiplier = (templateType == "NEQL"

      ? 500

      : (templateType == "N+"

            ? 100

            : 0));

 

def estimate = multiplier * issue.getOriginalEstimate() / 3600;

 

return String.format( '%,d', estimate as int);

We have tracked the problem to the fact that thsi custom field was defined as global.  So it was processing the field for every project but only existed on one, hence it was null on all other projects.  We have now changed the configuration of the field to the specific project and the noise in teh log file has disappeared.

1 answer

2 votes
Mark McCormack (Adaptavist)
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.
July 13, 2015

Roy,

Thanks for sharing the problem and your workaround.

Do you think this is a bug?

Perhaps a workaround would be to have ScriptRunner display a warning (at the very least) if a user chooses global context for a scripted field to make them aware they may face this problem?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events