The EDQ (Transaction) Log is a custom object used to store details of an API transaction and keep track of the validation status associated with a Salesforce record. EDQ Logs are accessed to allow our address, phone and email components to display the correct validation status for the given record and field API name.
Our package includes a service component, texperianledq-ledq-svc-metadata, designed to make the saving of transaction logs slightly more streamlined. This just needs to be included in the HTML template of your Lightning Web Component along with the validation components already detailed. Here's an example:
<template>
<texperianledq-ledq-svc-metadata></texperianledq-ledq-svc-metadata>
<texperianledq-ledq-cmp-email-validate-flow
...
This component will not require any attributes, but you will need to get a reference to it in order to make use of its methods. For example:
const metadataSvc = this.template.querySelector('texperianledq-ledq-svc-metadata');
You can then call its upsertTransactionLog method to save a transaction log against the record ID and field API name. To do so you will need to specify the following inputs:
| Attribute | Value | Additional notes |
|---|---|---|
| vType | address, phone, or email |
|
| recordId | The record ID of the associated record | |
| inputValue | event.detail.validationInputKey from the onvalidationstatuschange handler |
Makes sure the transaction log still matches the value saved in the database. |
| fieldAPIName | The API name of the associated field | Warning: If this is an address, you should use the first street field API name, for example BillingStreet. |
| status | event.detail.validationStatus from the onvalidationstatuschange handler |
|
| moreInfo | event.detail.validationMoreInfo from the onvalidationstatuschange handler |
Here's an example of using this method to save a transaction log for an Email field:
trySaveRecord() {
console.log("Saving record");
const metadataSvc = this.template.querySelector('texperianledq-ledq-svc-metadata');
metadataSvc.upsertTransactionLog({
vType: "email",
recordId: this.recordId,
inputValue: this.inputValue,
fieldAPIName: "Email",
status: this.status,
moreInfo: this.moreInfo
});
}