This article outlines the step-by-step process followed by the SubmitDataCleaningBatch Apex batch class, which is responsible for submitting records to Creditsafe for initial data cleaning and matching.
Submit Data Cleaning Batch
1. Overview
SubmitDataCleaningBatch is part of the automated enrichment flow. It handles the initial submission of Account records to Creditsafe, along with associated metadata and mappings, so that Creditsafe can begin the matching and enrichment process. This schedule runs on the hour.
2. Preparing Records for Submission:
- Gathers eligible records (e.g., Accounts) for submission. Maximum of 5,000 in a single data cleaning job.
- For each record:
- Collects the key data fields used for Matching.
- Builds a structured CSV.
- Sets the Last_Cleansed_Date__c to track the cleanse attempt:“account.CS_APP__Last_Cleansed_Date__c = Date.today()”
3. Generate CSV File:
- Creates a list of rows to be sent to Creditsafe in CSV format.
4. Updated Submitted Records:
- Updates the records with Last Cleansed Date.
5. Create Creditsafe Job via API:
- Makes a callout to the Creditsafe API to create a new data cleaning job:
ConnectDataCleaningService.createJob;
- This begins the Creditsafe matching process.
6. Upload File to Creditsafe:
- Sends the CSV data to the job using Creditsafe API.
7. Update Mappings and Submit the Job:
- Tells Creditsafe which fields have been mapped for the matching.
- Then submits the job.
8. Summary:
- Gather Accounts for cleansing.
- Build CSV for Creditsafe.
- Update records with Last Cleansed Date.
- Create Creditsafe job.
- Upload CSV file.
- Map fields & submit job.
This batch job handles the initiation of the matching and must be carefully structured to avoid callout restrictions imposed by Salesforce.
Enrich Data Cleaning Batch
Process: Step-by-Step Overview:
This document outlines the step-by-step process followed by the EnrichDataCleaningBatch Apex batch class, which is part of the data cleaning, matching, and enrichment workflow that integrates with the Creditsafe API.
Overview:
The EnrichDataCleaningBatch is responsible for retrieving completed Creditsafe enrichment jobs, extracting the enriched data, mapping it to Salesforce Account fields, and updating the corresponding records. This schedule runs every 30 minutes (on the hour and half past).
Important:
Credits are deducted from your available balance at this stage of the matching and enrichment process.
Step-by-Step Execution
1: Start Method
- Retrieves a list of enrichment jobs ready for processing.
2: Execute
2.1 - Checks for Completed Jobs
- Calls Creditsafe to retrieve completed enrichment jobs.
2.2 - Download the Enriched File
- Downloads the file with enriched data.
2.3 - Read Enriched Data
- Parses the enriched file into usable record data.
2.4 - Map Enrichment Data to Salesforce Fields
- Builds a mapping from Creditsafe fields to Salesforce Account fields.
2.5 - Retrieve the Matched Account Records
- Loads Accounts that are present in the enrichment file.
2.6 - Apply Enrichment Data to Accounts
- Populates the Accounts with the new enriched data.
2.7 - Update Accounts
- Updates the enriched Account records.
2.8 - Archive the Job in Creditsafe
- Archives the completed job.
Summary:
- Find completed Creditsafe jobs.
- Download enriched data file.
- Parse enriched content.
- Map enrichment fields to Salesforce Account fields based on Country Coverage.
- Retrieve “matching” Accounts from Salesforce.
- Apply enrichment field values to each Account.
- Update Accounts in Salesforce.
- Archive the data cleaning job.
You can now copy and paste this text as needed!