+ Start a Discussion
Rakesh Kumar 335Rakesh Kumar 335 

Workflow/Validation rule Help

"Customer State" is a field on lead object. The picklist values are CA, NJ,DC, AZ,IL, etc
The requirement is, if CA is selected, 'zipcode' field on lead should have a value '94544'. Similarly if 'NJ' is selected 07102 an so on.
How do i do this? workflow or formula or any easier way?
Best Answer chosen by Rakesh Kumar 335
vijayabhaskarareddyvijayabhaskarareddy
HI rakesh,
Try this formula field
IF(ISPICKVAL(Customer_State__c, 'CA'),'CAcode',(IF(ISPICKVAL(Customer_State__c, 'NJ'),'NJcode',(IF(ISPICKVAL(Customer_State__c, 'DC'),'DCcode',
  (  IF(ISPICKVAL(Customer_State__c, ' AZ'),' AZcode','ILcode')) )))))

Note:  pls select text type in formula field

All Answers

vijayabhaskarareddyvijayabhaskarareddy
you can use  formula fields, workflow and process builder
Rakesh Kumar 335Rakesh Kumar 335
Can you please tell me how i can use these? I'm a beginner. Thanks
Naveen Rahul 22Naveen Rahul 22
Hello Rakesh,

you need to go through below link
https://developer.salesforce.com/docs/atlas.en-us.fundamentals.meta/fundamentals/adg_simple_app_adv_field_dependencies_try_it_out.htm

Thanks
D Naveen Rahul.
vijayabhaskarareddyvijayabhaskarareddy
HI rakesh,
Try this formula field
IF(ISPICKVAL(Customer_State__c, 'CA'),'CAcode',(IF(ISPICKVAL(Customer_State__c, 'NJ'),'NJcode',(IF(ISPICKVAL(Customer_State__c, 'DC'),'DCcode',
  (  IF(ISPICKVAL(Customer_State__c, ' AZ'),' AZcode','ILcode')) )))))

Note:  pls select text type in formula field
This was selected as the best answer
Rakesh Kumar 335Rakesh Kumar 335
Hi Vijayabhaskarareddy
i get the error "Error: Field Customer_State__c may not be used in this type of formula"error
Rakesh Kumar 335Rakesh Kumar 335
Pleaste note that "customer state" and Postal code are two seperate custom field on lead.
Based on customer state value selected in customer state field, the value to be populated in postal code field.
ex: if i select 'CA' in customer state picklist, the postal code value should be '94544'
vijayabhaskarareddyvijayabhaskarareddy
if u want to create formula field  
 first go to create new custom fields
then select formula field, and then inside formula select text type

Step1: select formula
step1
step2 :inside formula field select  text type
User-added image



 
Rakesh Kumar 335Rakesh Kumar 335
Thanks. I made slight change and it worked
IF(ISPICKVAL(Customer_State__c, 'CA'), '94544', IF( ISPICKVAL(Customer_State__c, 'NJ'), '94521',  IF( ISPICKVAL(Customer_State__c, 'DC'), '73622',  IF( ISPICKVAL(Customer_State__c, 'AZ'), '26366',  IF( ISPICKVAL(Customer_State__c, 'IL'), '36455', '') ) ) ) )