function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
otbuildotbuild 

Validation rule exception "Error: java.lang.NullPointerException"

When I try to create validation rule on Opportunity Object, I get "Error: java.lang.NullPointerException". The Error Condition Formula for validation rule is as shown below:

AND
(
ISPICKVAL( Account.Restaurant_Country__c , "India") = false,
NOT(ISPICKVAL(PRIORVALUE( StageName),'Closed Won')),
ISPICKVAL(StageName, 'Closed Won'),
ISBLANK(Account.PC__c)
)

When I remove first and last conditions in Formula, I do not get null pointer exception. I'm getting null pointer exception on only one sandbox. When I try to create valiation rule with same formula on other sandbox, I do not get exception.

Because of this exception, we are not able to deliver these valiation rules from one sandbox to other using Change Set. Any thoughts on why null pointer exception and how do we resolve this issue?

kcpluspluskcplusplus

(
ISPICKVAL( Account.Restaurant_Country__c , "India"),
NOT(ISPICKVAL(PRIORVALUE( StageName),'Closed Won')),
ISPICKVAL(StageName, 'Closed Won'),
ISBLANK(Account.PC__c)
)

 

I would remove the = false from the ispickval, the function already returns a boolean value, so you don't need to define that at the end. Not sure if that is the cause of your particular issue, but it is an issue. 

 

--KC