Tuesday, 9 May 2017

VLOOKUP Example | VLOOKUP Function in Salesforce | Validation Rule with Vlookup in Salesforce

In this example we will checks that a billing postal code is valid by looking up the value in a custom object called ZipCode__c that contains a record for every valid zip code. If the zip code is not found in the ZipCode__c object or the billing state does not match the corresponding State__c in the ZipCode__c object, an error will display.

Syntax :- VLOOKUP(field_to_return, field_on_lookup_object, lookup_value)

field_to_return :- the field that contains the value you want returned
field_on_lookup_object :- the field on the related object that contains the value you want to match
lookup_value :- with the value you want to match

VLOOKUP Example in Salesforce Step by Step process

Step 1) Create one custom object ZIPCODE

Step 2) Upload some Test data.

Step 3) Create Validation Rule

       $ObjectType.ZipCode__c.Fields.State__c ,
       $ObjectType.ZipCode__c.Fields.Name ,
) != BillingState

Please check below post for more detail
1) https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=0&language=en_US

Amit Chaudhary