I found the answer to my question. When passing String parameters in the Getter Chain, we don't need to include quotes. So instead of toString().indexOf("NEW") we should use toString().indexOf(NEW)
There are other caveats too. I found the answer in the documentation here:
https://docs.appdynamics.com/display/PRO41/Getter+Chains+in+Java+Configurations