How to use Upsert in Salesforce?
How to import Data by using Data import wizard in Salesforce?
How to take an Export Data in Salesforce?
How to do a Mass Transfer of Records in Salesforce?
How to do a Mass Delete of Records in Salesforce?
How to use a Data Loader in Salesforce?
How to use SOAP API and REST API in Salesforce?
For all the answers to the above questions check out this document:
How to manage data in Salesforce.com
So you have two options now:
- Add a Validation Rule on the Employee which checks whether there are any existing Employee records with the same name if so stop the User from saving it. Here comes the role of VLOOKUP.
- Create an Apex Trigger(before Insert, before Update) which runs a SOQL query to get all the Employee records in the Org with same name as of the one thats getting created now. If the number of records is 1 then stop the User from creating the Employee using an addError method. This will require considerable development effort.
Now, since we are interested in VLOOKUP lets see as of how we can do the same. Create a Validation Rule as below:(2) $ObjectType.Employee__c.Fields.Name ,
(3) Name)
Now, our basic requirement is to check if an another Employee with the same Name exists or not. So its obvious we are looking into the Name field. The logic is quite simple compare the Name (4) on the Current Record and theName on that Employee record that matched with the same Name as of the one that we are creating now. Hence we use the equality operator (=).
Lets look into the VLOOKUP side. You could express the VLOOKUP formula as below: "Look into the Name(2) field on all the Employee Records and return value in it's Name (1) field if the it happens to be same as the Name(3) on the Current Record."
The SFDC Document define VLOOKUP as follows:
Points to Remember: