Skip to main content
2 个回答
  1. 2015年10月28日 05:27
    Hi  Madhukar,

    Suppose that you are creating Employee(a custom object) records in the SF org. Now since Employees are very important records, you do not want the users to create duplicate Employee again and again. For example, say one User already created an Employee Record with name - Madhukar . Now, an another User who does not know about this tries to create an another Employee record with the same name - Madhukar.and hence there is a potential duplication. This should not be allowed. 

    So you have two way:
    1.  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.
    2.  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.

     

    Validation Rule is-

              VLOOKUP(field_to_return, field_on_lookup_object, lookup_value)

     field_to_return--Return all employee name

    field_on_lookup_object--all the Employee Records 

    lookup_value---New employee name

    Example-  

    Name = VLOOKUP( Employee__c.Fields.Name , Employee__c.Fields.Name ,  Name)

    Thanks

    Rupal.

     

     
0/9000