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
Sinan Bunni 24Sinan Bunni 24 

process aumation specialist

Hi All,
I know this quesiton has been asked by many and answered in many different way, however, I am still not able to fix the issus in the Lead State validation rule... I am getting this error:

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Only valid US states are allowed: []

My validation rule is as below:
 
OR( 
   LEN(State) <> 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:PR", State))
   )

any help is highly appreciated. Thanks
 
Guan Tay 4Guan Tay 4
I saw Salesforce team has a TYPO in the input to test validation, instead of "NY" they have used "NYY" in the input. If you change the word NY to NYY the validation rule should pass. Note: this is just a temporary fix as Salesforce will still need to fix their input!
Claire JonesClaire Jones
Do not correct to allow NYY to pass - this is them testing to check that it will NOT pass if state is entered as three letters. I passed this stage successfully on Friday (28th) so know it to be true.
My State validation rule also checked for uppercase letters using REGEX - don't know if that was the deciding factor.

Alternatively, the issue may be that you have not written the second validation rule to check that the Country is US, USA, United States or blank.
Sinan Bunni 24Sinan Bunni 24

Hi @Guan Tray - I tried your approach, still failing to pass.
HI @Claire Jones - I have created the other validation rule and it seem to pass the tests correctly - see below:

Not( 
OR ( Country = "US", Country ="USA", Country = "United States", ISBLANK( Country )))

Please let me know if you have other thoughts to pass in the first step or if you could share you validation rules with me for comparision reasons (I know they are simple - not rocket sience).

Thanks, Sinan

Guan Tay 4Guan Tay 4
@Claire Jones good to know that because that's the input I saw from Developer Console when I tried to debug the validation rules, thought they might have typo in their codes.