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
Nae 88101Nae 88101 

help needed with Validation rule in Accounts

 I have set up the following formulla in Accounts:
 
AND (
OR(BillingCountry = "US", BillingCountry="USA", LEN(BillingCountry)=0),
OR(
LEN(BillingState) < 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", BillingState)
)))
 
 
My problem is when my users attempt to convert a  lead  (company  is non existant) it gives the following error:      
Error: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A valid two-letter state code is required.: [BillingState] (System Code)
 
Which is triggerd by the formula above.  Is there any way to leave the formula in place but still be able to convert the lead?  
AdminisaurusRexAdminisaurusRex
If you use the same exact validation rule on your Lead page, it will ensure that there is enough data on the record before it is converted.