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
ManishSManishS 

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

  
Abdul KhatriAbdul Khatri
Hi 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
 
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 )
)))

Let me know if this helps
gilber tivangilber tivan
The feed.kroger.com is an online official web portal started by Kroger. On the feed.kroger.com portal, the employees use an Enterprise User ID and a Password to access the login portal and see Feed Kroger securely. Let's Check Here: Feed Kroger Login
Frank Hart 10Frank Hart 10
A commitment of appreciation is all together for the reliably steady exercise. Achieves the best outcome! The methodology worked for me because of the space people for the system. Flying Together (https://www.flying-together.net/)
Arun Kumar 1141Arun Kumar 1141
Hi ManishS,

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!
Sheila HopkinsSheila Hopkins
We have calculate for the effect of each methods and if merger all methods in one with a right time for diversification of backlink, it will give us one big effect for SEO solution.

Read on: Buy complete link building service (https://good-backlink.com/complete-link-building-service.html)