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
bhanu_prakashbhanu_prakash 

I need to store zipcode and need to make validation

I need to store zipcode and need to check whether zipcode entered by user is valid or not. How can i achevie it ?
Gopal AgrawalGopal Agrawal
Hi,

As per my understanding, you want to store ZIP code in the custom setting and then cross check if entered ZIP code exists in the database or not.

If above is correct then we can create a before insert trigger which will cross check zip code with zip code in cutom setting and then display error , if it will not match.

Please let me know , if this help you.
 
Shiva RajendranShiva Rajendran
Hi Bhanu ,
I'm not sure if it is possible using formula field or validation rule . Based on certain validation  criteria check a checkbox like isDataField.
What i can suggest you is use worflow onupdate
when the criteria is not met ,update the checkbox isDataField as false. Now you will save the record, also you would know if the record is valid or not.
Thanks and Regards,
Shiva RV
Amit Chaudhary 8Amit Chaudhary 8
Hi bhanu prakash 153,

You Can do the same with the Help of Vlookup formula in salesforce. Please check below post for same
1) https://success.salesforce.com/answers?id=90630000000gyFzAAI
2) http://developer.force.com/cookbook/recipe/validating-data-based-on-fields-in-other-records

Please follow below step
1) Create a custom object called ZIP Code with the following settings: FieldValue
2) Add the following custom fields to the ZIP code object: Field LabelData Type
3) Create a validation rule on you object that uses the following formula:
LEN(ZIP_Code__c) > 0 &&
(Country__c = "USA" || Country__c = "US") &&
VLOOKUP(
$ObjectType.ZIP_Code__c.Fields.City__c,
$ObjectType.ZIP_Code__c.Fields.Name,
LEFT(ZIP_Code__c,5))
<> City__c
)
Please check below post for step by step process
1) http://developer.force.com/cookbook/recipe/validating-data-based-on-fields-in-other-records

Let us know if this will help you
 
bhanu_prakashbhanu_prakash
please help me above solution
Amit Chaudhary 8Amit Chaudhary 8
Hi Bhanu,

 Please check below post for step by step process
1) http://amitsalesforce.blogspot.com/2017/05/vlookup-example-vlookup-function-in.html

Please let me know if this will help you.