You need to sign in to do that
Don't have an account?

Two letter US State code validation (Should be validated when ONLy State field is populated)
Hi All,
I dont know if its the case of CONTAINS but when I tried using the famous two letter US State validation code then it didnt allow me to save a record when I dont have any data for address field. To be more specific following valiation is norammly used on Leads to verify if the user has correctly entered valid US code:
AND(NOT(ISNULL( State )),
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", State )
)))
But when I dont want to fill any address info then also this formula restricts me to save Lead record making address as a required field.
Please let me know how to modify this: I only need validation when State field is filled and NOT when either State or all five address fields are empty.
Any clue is highly appreciated:)
MAnish
I dont know if its the case of CONTAINS but when I tried using the famous two letter US State validation code then it didnt allow me to save a record when I dont have any data for address field. To be more specific following valiation is norammly used on Leads to verify if the user has correctly entered valid US code:
AND(NOT(ISNULL( State )),
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", State )
)))
But when I dont want to fill any address info then also this formula restricts me to save Lead record making address as a required field.
Please let me know how to modify this: I only need validation when State field is filled and NOT when either State or all five address fields are empty.
Any clue is highly appreciated:)
MAnish
I change ISNULL to ISBLANK
Text Fields are never NULL, therefore ISNULL is always return true and validation rule was trigger all the time. This is the main difference between ISNULL and ISBLANK
Let me know if this helps
I have modified the validation rule to exclude the requirement for the address fields when the State field is empty.
Updated validation rule is as follows:
AND( NOT(ISBLANK(State)), 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", State ) ) ) )
Here, If the State field is empty, the updated validation rule will not enforce the uniqueness requirement, allowing you to save the record even if the address fields are empty.
Hope this helps.
Thanks!
Read on: Buy complete link building service (https://good-backlink.com/complete-link-building-service.html)