You need to sign in to do that
Don't have an account?
petec@i2isys
Validation rule not working if value = 0
I have a rule to compare the number of hours being used in a custom object against the number of hours available on another custom object. The number of hours available on the other object is a roll up summary field. If the number of hours being used are less than available, everything works. If the number of hours being used are greater that hours available, the rule works and fires an error. But if the hours being used are exactly = to hours available, the rule is firing a validation error when it shouldn't. See debug code below:
29.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
15:20:52.069 (69354942)|EXECUTION_STARTED
15:20:52.069 (69408880)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Professional_Services_Training_Usage:new
15:20:52.069 (69421708)|VALIDATION_RULE|03d40000000H4xy|Cannot_Exceed_Hours
15:20:52.069 (69666941)|VALIDATION_FORMULA|(Training__r.Hours_Remaining__c - Hours_Used__c)< 0.0|Hours_Used__c=2.0 , Training__r.Hours_Remaining__c=2.0
15:20:52.069 (69675079)|VALIDATION_FAIL
15:20:52.069 (69691504)|CODE_UNIT_FINISHED|Validation:Professional_Services_Training_Usage:new
15:20:52.069 (69696463)|EXECUTION_FINISHED
29.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
15:20:52.069 (69354942)|EXECUTION_STARTED
15:20:52.069 (69408880)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Professional_Services_Training_Usage:new
15:20:52.069 (69421708)|VALIDATION_RULE|03d40000000H4xy|Cannot_Exceed_Hours
15:20:52.069 (69666941)|VALIDATION_FORMULA|(Training__r.Hours_Remaining__c - Hours_Used__c)< 0.0|Hours_Used__c=2.0 , Training__r.Hours_Remaining__c=2.0
15:20:52.069 (69675079)|VALIDATION_FAIL
15:20:52.069 (69691504)|CODE_UNIT_FINISHED|Validation:Professional_Services_Training_Usage:new
15:20:52.069 (69696463)|EXECUTION_FINISHED
Can you just for the hell of it, change 0.0 to 0 and see if it makes any difference?
ROUND((Training__r.Hours_Remaining__c - Hours_Used__c), 1) < 0
I tested it and it worked.