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
Patricia LimPatricia Lim 

Process Automation Specialist Challenge 2 Validation Rule Apex Code syntax error

Hi all, I am trying to complete the second step of the process automation specialist creating a validation rule however it is giving me a syntax error despite using code that others have used with no errors:
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 am not a dev, however I am trying to learn the basics as an admin
AbhishekAbhishek (Salesforce Developers) 

For all the Trailhead issues please report it here,

So that our trailhead support engineers will look into it and get back to you.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

​​​​​​​Salesforce Support.
David Zhu 🔥David Zhu 🔥
The fomular should work. The issue is you use unicode quotation mark “ in the formular, replace it with ASCII ".
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))) )