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
twrig15twrig15 

Validation Rule to avoid record creation if a record formula field will be exceeded

Hello,

I have a validation rule that I need to pretend a record from being save on creation on the Training Object if the record will exceed the number of Hours Purchased (Formula Field on a related Account Object).

My current formula looks like this but it is only working when I edit the record.

AND(Account__r.Total_of_Hours_Used__c > Account__r.Total_Of_Hours_Purchased__c, ISPICKVAL( Account__r.Training_Billing_Type__c, "Prepaid"),
AND( ISNEW() 
)
)

 
Best Answer chosen by twrig15
twrig15twrig15
I was able to solve by using: Training Length > Total_Of_Hours_Available && Training_Billing_Type__c = "Prepaid"

All Answers

Shashikant SharmaShashikant Sharma
Hi,

Your validation rule looks fine to me. Just make sure 

1. You are checking by populating correct account which satisfies the condition to valdiate
Total_of_Hours_Used__c  > Total_Of_Hours_Purchased__c and Training_Billing_Type__c = "Prepaid"
2. There is no other process which changes values in abckground and validation is skipped.

Thanks
Shashikant
twrig15twrig15
I was able to solve by using: Training Length > Total_Of_Hours_Available && Training_Billing_Type__c = "Prepaid"
This was selected as the best answer