This is a custom object used to store API transactions as a log record. It's used to display the validation status for each address/email/phone field of a related record. It can also be used to run reports on the different records that have been validated.
This is an example of the list view of the log records:
These records store the following information:
Field | Description |
---|---|
Created By | The user and timestamp that created the EDQ log item. |
Error JSON | JSON string returned by API for errors. |
ErrorMessage | Error messages if any displayed on the front end. |
FieldAPIName | Field that was validated. |
Input Value | Input value encoded to comply with GDPR. |
Last Modified By | The user and timestamp that last modified the EDQ log item. |
More Info | Additional meta data encoded as a JSON string. |
Owner | The user that validated the record. |
Related Record ID | Record ID where the validation happened. |
Status | Status that came back from Experian API and displayed on the front end. |
TimeStamp | Timestamp of the validation. |
Validation Type | Type of validation. |
There are certain scenarios when you might need to manually create an EDQ Log record, for example if an address/email/phone field is populated by another system and you want to display the EDQ status indicator next to the field. One way of achieving this might be to use triggers after an object is created to also create the associated EDQ Log record.
Here are some examples for the cases of the Contact object and its Mailing Address, Email and Mobile Phone fields, which could be repurposed as required:
trigger LEDQ_SetAddressValidationStatus on Contact (after insert) {
List <TExperianLEDQ__LEDQ_TransactionLog__c> edqLogToInsert = new List <TExperianLEDQ__LEDQ_TransactionLog__c> ();
for (Contact c : Trigger.new) {
// instantiate the new log object
TExperianLEDQ__LEDQ_TransactionLog__c tl = new TExperianLEDQ__LEDQ_TransactionLog__c ();
tl.OwnerId = c.OwnerId;
tl.TExperianLEDQ__LEDQ_RecordId__c = c.Id;
tl.TExperianLEDQ__LEDQ_TimeStamp__c = System.now();
tl.TExperianLEDQ__LEDQ_FieldAPIName__c = 'MailingAddress'; // update fieldApiName as required
tl.TExperianLEDQ__LEDQ_Type__c = 'Address';
tl.TExperianLEDQ__LEDQ_More_Info__c = '';
// address is concatenated, encoded and stored in input value
tl.TExperianLEDQ__LEDQ_InputValue__c = '';
String concatAddress = String.join(new List<String>{c.MailingStreet, c.MailingCity, c.MailingPostalCode, c.MailingState, c.MailingCountry}, ','); // can also add the following to this list: c.MailingStateCode, c.MailingGeocodeAccuracy, String.valueOf(c.MailingLatitude), String.valueOf(c.MailingLongitude)
if (concatAddress != NULL || concatAddress != '') {
tl.TExperianLEDQ__LEDQ_InputValue__c = EncodingUtil.base64Encode(blob.valueof(concatAddress));
}
// initially set status to 'ManuallyUpdated', depending on how you integrate the AV response, you can feed that into a custom field and access that field's value to update the EDQ log status accordingly
tl.TExperianLEDQ__LEDQ_Status__c = 'ManuallyUpdated'; // possible values include 'ManuallyUpdated', 'Unverified', 'AddressVerified'
// add new log object to the list that will later be inserted
edqLogToInsert.add(tl);
}
try {
// ensure we have sufficient permissions before attempting to insert new transaction log
if(Schema.sObjectType.LEDQ_TransactionLog__c.isAccessible() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isUpdateable() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isCreateable()) {
insert edqLogToInsert;
} else {
system.debug('Missing LEDQ_TransactionLog__c permissions, abandoned insert attempt.');
}
} catch (system.Dmlexception e) {
system.debug(e);
}
}
trigger SetPhoneValidationStatus on Contact (after insert) {
List <TExperianLEDQ__LEDQ_TransactionLog__c> edqLogToInsert = new List <TExperianLEDQ__LEDQ_TransactionLog__c> ();
for (Contact c : Trigger.new) {
// instantiate the new log object
TExperianLEDQ__LEDQ_TransactionLog__c tl = new TExperianLEDQ__LEDQ_TransactionLog__c ();
tl.OwnerId = c.OwnerId;
tl.TExperianLEDQ__LEDQ_RecordId__c = c.Id;
tl.TExperianLEDQ__LEDQ_TimeStamp__c = System.now();
tl.TExperianLEDQ__LEDQ_FieldAPIName__c = 'Email'; // update fieldApiName as required
tl.TExperianLEDQ__LEDQ_Type__c = 'Email';
tl.TExperianLEDQ__LEDQ_Status__c = 'EmailManuallyUpdated'; // possible values: 'verified', 'unreachable', 'unknown', 'undeliverable', 'illegitimate', 'disposable', 'EmailManuallyUpdated'
tl.TExperianLEDQ__LEDQ_InputValue__c = EncodingUtil.base64Encode(Blob.valueOf(c.Email));
tl.TExperianLEDQ__LEDQ_More_Info__c = '';
// add new log object to the list that will later be inserted
edqLogToInsert.add(tl);
}
try {
// ensure we have sufficient permissions before attempting to insert new transaction log
if(Schema.sObjectType.LEDQ_TransactionLog__c.isAccessible() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isUpdateable() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isCreateable()) {
insert edqLogToInsert;
} else {
system.debug('Missing LEDQ_TransactionLog__c permissions, abandoned insert attempt.');
}
} catch (system.Dmlexception e) {
system.debug (e);
}
}
trigger SetPhoneValidationStatus on Contact (after insert) {
List <TExperianLEDQ__LEDQ_TransactionLog__c> edqLogToInsert = new List <TExperianLEDQ__LEDQ_TransactionLog__c> ();
for (Contact c : Trigger.new) {
// instantiate the new log object
TExperianLEDQ__LEDQ_TransactionLog__c tl = new TExperianLEDQ__LEDQ_TransactionLog__c ();
Map<String, String> moreInfoRaw = new Map<String, String>();
moreInfoRaw.put('phoneCode', '44'); // adjust phone code for appropriate country
moreInfoRaw.put('validatedNumber', c.MobilePhone);
moreInfoRaw.put('number', '44' + c.MobilePhone); // adjust phone code for appropriate country
moreInfoRaw.put('codeLessNumber', c.MobilePhone);
tl.OwnerId = c.OwnerId;
tl.TExperianLEDQ__LEDQ_RecordId__c = c.Id;
tl.TExperianLEDQ__LEDQ_TimeStamp__c = System.now();
tl.TExperianLEDQ__LEDQ_FieldAPIName__c = 'MobilePhone'; // update fieldApiName as required
tl.TExperianLEDQ__LEDQ_Type__c = 'Phone';
tl.TExperianLEDQ__LEDQ_Status__c = 'PhoneManuallyUpdated'; // possible values: 'Verified', 'Unverified', 'Unknown', 'Absent', 'Dead', 'No coverage', 'Teleservice not provisioned', 'PhoneManuallyUpdated'
tl.TExperianLEDQ__LEDQ_InputValue__c = EncodingUtil.base64Encode(Blob.valueOf(c.MobilePhone));
tl.TExperianLEDQ__LEDQ_More_Info__c = JSON.serialize(moreInfoRaw);
// add new log object to the list that will later be inserted
edqLogToInsert.add(tl);
}
try {
// ensure we have sufficient permissions before attempting to insert new transaction log
if(Schema.sObjectType.LEDQ_TransactionLog__c.isAccessible() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isUpdateable() &&
Schema.sObjectType.LEDQ_TransactionLog__c.isCreateable()) {
insert edqLogToInsert;
} else {
system.debug('Missing LEDQ_TransactionLog__c permissions, abandoned insert attempt.');
}
} catch (system.Dmlexception e) {
system.debug (e);
}
}
The Status field of the EDQ Log object can contain one of the following values: