Skip to content

Instantly share code, notes, and snippets.

@britishboyindc
Created February 28, 2017 18:27
Show Gist options
  • Save britishboyindc/a9999e87e659612633406d28bd5ab157 to your computer and use it in GitHub Desktop.
Save britishboyindc/a9999e87e659612633406d28bd5ab157 to your computer and use it in GitHub Desktop.
Apex ZDM Lookup for Contact
//Instantiate Contact and include KW Fields on object
Contact c = new Contact();
//Set Address
c.MailingStreet = '4205 Cordobes Cv';
c.MailingCity = 'San Diego';
c.MailingState = 'CA';
c.MailingPostalCode = '92130';
//KW Fields (populate if already processed contact)
c.kwzd__KW_Error_Code__c = '';
c.kwzd__Latitude__c = NULL;
c.kwzd__Longitude__c = NULL;
c.kwzd__ZTDM_Expiry_Date__c = NULL;
c.kwzd__KWD_Last_Processed_DT__c = NULL;
c.kwzd__Zip_4__c = NULL;
c.kwzd__KW_USHouseDistrict__c = '';
c.kwzd__KW_USHouseDesc__c = '';
//Single Record Class
kwzd.KWD_SingleRecordUpdate kws;
String sErrorMessage = '';
try {
kws = new kwzd.KWD_SingleRecordUpdate();
kws.executeupdate('Contact', c);
}
Catch (Exception Ex) {
system.debug(Ex);
sErrorMessage = Ex.getmessage();
}
if (kws.showerrors) {
system.debug(kws.dbError);
sErrorMessage = kws.dbError;
}
else {
//Convert processed object back to original Contact object
system.debug( (Contact)kws.soProcessed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment