This feature will only run on creation of a object and it requires the EDQ validation components to be on the record page. Any updates to email and phone fields will be taken care of by the corresponding components.

Assumptions

  • No address will be validated as validation of this field is a two steps process for Experian API.
  • Only phone and email fields are validated.
  • Phone should contain a valid country code along with the number. Any data entered by user in phone fields will be sent to the Experian API to validate.
  • Default country logic is not considered here.
  • The EDQRunWebtoObject checkbox field should be created on the object you want to run WebtoObject functionality, as described below.
  • Enabling and disabling of profiles in profile settings is not considered.

How to add the EDQRunWebtoObject checkbox to an Object

  1. Go to Object Manager in Setup.
  2. Select the Object you want to add the validation to, e.g. Lead.
  3. Select Fields & Relationships.
  4. Click New to create a new field.
  5. In Step 1 select Checkbox as the field type and click Next.
  6. In Step 2 enter EDQRunWebtoObject as the Field Label and choose whether you want the validation to be run by default by selected Checked or Unchecked for the Default Value. The Field Name will be autopopulated. You can also enter a Description and Help Text if you require. Once all the details have been entered click Next.
  7. In Step 3 decide who the checkbox should be visible to and whether it can be edited and then click Next.
  8. In Step 4 decide which page layouts should include the checkbox and then click Save.

How to create the Trigger

  1. Go to Object Manager in Setup.
  2. Select the Object you want to add the validation to, e.g. Lead.
  3. Select Triggers.
  4. Click New to create a new trigger.
  5. Paste the following code into the Apex Trigger tab:
    trigger Webto[Object API Name] on [Object API Name] (after insert) {

        // Field names of email and phone fields that should be validated by Experian
        List<String> fields = new List<String>{'[Field Name]', '[Field Name]' ,...};

        // Only validate the fields on records which have the EDQRunWebtoObject field checked
        List<[Object API Name]> records = new List<[Object API Name]>();

        for ([Object API Name] sobjRecord : Trigger.new) {
            if (sobjRecord.EDQRunWebtoObject__c) {
                records.add(sobjRecord);
            }
        }

        if (!records.isEmpty() && records.size() > 0) {
            if (Trigger.isInsert) {
                TExperianLEDQ.LEDQ_WebToObjectService.validateWebToObjectService(fields, records);
            }
        }
    }
  1. In the pasted code, replace [Object API Name] with the object in question, e.g. Lead.
  2. Also replace [Field Name] with the list of email and phone fields in the object which should be validated. Each name should be surrounded by single quotes and separated by a comma, e.g. 'Email', 'Phone', 'MobilePhone'.
  3. When finished click Save.