Mapping Data to Custom Fields

To map ZoomInfo data to custom fields you will need to use a trigger. Please take a look at the below sample code to understand how to do this.


The sample code below copies the Title field on a Lead object to “Title__c” custom object. A trigger can be written on Lead, Contact or Account objects as they all are touched by the ZoomInfo integration and all these 3 objects have the “zisf__zoom_id__c” and “zisf__zoom_lastupdated__c” fields.


For more assistance on writing a trigger, please contact your Salesforce Administrator or Salesforce customer service.


Sample Code:

/*

Trigger to store data in custom fields when imported or updated from ZoomInfo Salesforce App

*/

trigger zoomInfoLeadFieldhandler on Lead (before insert, before update) { 

    for (Lead a : Trigger.new) {

        if (((Trigger.isInsert == true) && (a.zisf__zoom_id__c != null)) ||

            ((Trigger.isUpdate == true) && (a.zisf__zoom_lastupdated__c != null) &&

            ((a.zisf__zoom_lastupdated__c != trigger.oldmap.get(a.Id).zisf__zoom_lastupdated__c) ||

            (trigger.oldmap.get(a.Id).zisf__zoom_lastupdated__c == null)))) {

            a.Title__c = a.Title

        }

    }

} 

// Test Class 

/**

    To cover Trigger: zoomInfoLeadFieldhandler

*/ 

@isTest 

private class zoomInfoLeadFieldhandler_Test { 

    static testMethod void coverzoomInfoLeadFieldhandler() {

        Lead a = new Lead();

        a.lastName = 'TestMethod';

        a.Company = 'Test Company Inc.';

        a.zisf__zoom_id__c = '12343';

        a.Title = 'Manager';




        insert a;

    }

}


Was this article helpful?

Can’t find what you’re looking for?

Contact our award-winning customer care team.