I have a global variable stuck at null. I want to use it as a counter, but I can't add anything to it (can't add to null). When I created it, I wanted to initialize to 0, but there was no way to do that. So I was getting this:
java.lang.NullPointerException: Cannot execute null+1 (addVar)
Until I wrote a trigger to initialize it. A lot of work for what amounts to:
int intCounter = 0;
Also, something happened last night, and the variable was back to null, and everything was broken.
Is there an easier way?
I suspect the problem is that global variables aren't actually global, better to use a state variable, although that will only persist at the end of execution.