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
Dulce AmayaDulce Amaya 

Superbadge Process Automation Specialist: Automate Accounts

Hello!
I'm having some trouble with the Process Automation Specialist Superbadge - Challenge 2. I keep getting the following error:

Challenge Not yet complete... here's what's wrong: 
A validation rule did not prevent a new Account from being saved when Billing Country is blank and Billing State has three characters.

These are my validation rules:

LEN( ShippingState ) <> 2 || 
NOT( CONTAINS ("AL:AK:AZ:AR:CA:CZ:CO:CT" & 
"DE:DC:FL:GA:GU: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:PR:RI:SC:SD:TN:TX:UT" & 
"VT:VI:VA:WA:WV:WI:WY" , ShippingState )) || 
(ShippingCountry <> 'USA' && ShippingCountry <> 'US' && ShippingCountry <> 'United States' && NOT( ISBLANK(ShippingCountry)))

------------

LEN( BillingState ) <> 2 || 
NOT( CONTAINS ("AL:AK:AZ:AR:CA:CZ:CO:CT" & 
"DE:DC:FL:GA:GU: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:PR:RI:SC:SD:TN:TX:UT" & 
"VT:VI:VA:WA:WV:WI:WY" , BillingState )) || 
(BillingCountry <> 'USA' && BillingCountry <> 'US' && BillingCountry <> 'United States' && NOT( ISBLANK(BillingCountry)))

Can anyone help me please?
VinayVinay (Salesforce Developers) 
Please note that Questions about how to pass Trailhead challenges are not on topic, because these challenges are intended to be independent demonstrations of your abilities.

Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.

Please close the thread by selected as Best Answer so that we can keep our community clean

Thanks,
Suraj Tripathi 47Suraj Tripathi 47
Hi Dulce Amaya,

Answer: 
OR(
AND(
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 ))
),
AND(
LEN( ShippingState ) > 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" , ShippingState ))
),
NOT(OR( BillingCountry ="US", BillingCountry ="USA", BillingCountry ="United States", ISBLANK ( BillingCountry ))),
NOT(OR( ShippingCountry ="US", ShippingCountry ="USA", ShippingCountry = "United States", ISBLANK( ShippingCountry )))
)
I hope you find the above solution helpful. If it Does, Please mark it as Best Answer to help others too.

Thanks and Regards,
Suraj Tripathi