You need to sign in to do that
Don't have an account?
how to bypass validation rules in apex test class
Hi,
Iam having some validation rules on some field let us say that field is discount in the apex class iam having the condition like
if(obj.discount >100)
{
some code
}
now to cover this condition in the test class it is not allowing and showing an exception like this
; first error: FIELD_INTEGRITY_EXCEPTION, The Discount Percent must be between 0 and 100: [Discount]
how to overcome this exception any ideas
Iam having some validation rules on some field let us say that field is discount in the apex class iam having the condition like
if(obj.discount >100)
{
some code
}
now to cover this condition in the test class it is not allowing and showing an exception like this
; first error: FIELD_INTEGRITY_EXCEPTION, The Discount Percent must be between 0 and 100: [Discount]
how to overcome this exception any ideas
You can add one condition in teh validation rule that it should not fire for admin profile or you want for system admin as well ?