Document toolboxDocument toolbox

Avoid Scriptrunner script from failing on Data Center

Hosting

DATA CENTER

Problem

While using my Scriptrunner script in order to update Projectrak values, sometimes we receive this message:

java.lang.NoClassDefFoundError: com/deiser/jira/profields/api/field/status/StatusField

How can avoid this from failing?

Solution

When using Scriptrunner script listener with 3rd party apps as Projectrak, sometimes ScriptRunner's groovy cache fails to be deleted. Below these lines, you will find some groovy script lines that will erase these groovy caches, making this script work 100% of the time. 

com.onresolve.scriptrunner.runner.ScriptRunnerImpl.getScriptRunner().init()

This line clears ScriptRunners' groovy cachés as it is done in built-in scripts. Just by adding it to the first part of your script, you will have solved this problem.