Accord Sync can be scheduled to validate the integrity of synced records using Change Data Capture (CDC) with the QBO API. This will provide an extra layer of reliability in the event webhooks are not fired by QuickBooks Online. This feature creates/updates the Status on Accord Record Statuses with either: QBO Record Created, Newer Record Available, or QBO Record Deleted if the record is out of sync.
CRITICAL
The order that data is validated leveraging scheduled jobs is critical. If related records don’t exist in Salesforce, the integration of the related information will fail. For example, before Invoices can be sent to Salesforce the Account must be created if using a lookup or master-detail relationship. So, a job for Customers must be scheduled before a job for Invoices is created.
This feature uses the Change Data Capture (CDC) operation provided by the QBO API and is only capable of returning 1,000 of the most recent changes based on the date/time provided. To prevent any issues, schedule the sync integrity validation to run more frequently if your QuickBooks instance experiences more than 1,000 changes per day for example.
Schedule Sync Integrity Validation
- Navigate to the Accord Admin tab in Accord Sync app. Click on the Sync Integrity tab.
- Enter a name for the Scheduled Job. It must be unique for each combination of QuickBooks object(s) to avoid errors of duplicate job names.
- Select one of the preconfigured Types to set up the frequency of the job.
- Select the QuickBooks Company that the sync will be scheduled for.
- Check the QuickBooks Objects that will be validated for changes from QuickBooks Online.
- Define the scheduled times that the job should automatically run to validate the integrity of the selected objects between QuickBooks and Salesforce.
Once
This will run the sync only one time.
Start: The date and time at which the job will run
This scheduled job will run one time on March 22, 2022 at 1:00 PM.
Recurring
This has a few preconfigured frequencies at which syncs can run such as hourly, daily, and weekly to quickly schedule a job.
Frequency: Determines how often the job will run
Run Every (Hourly): The amount of hour(s) that need to pass before running the sync again. (Select 1 for every hour)
Minute (Hourly): The minute of the hour when the sync will run.
Run (Daily): Option to run job every day or every weekday.
Run Every (Weekly): The day(s) of the week that the job should run.
At (Daily): The time at which the job will run.
This scheduled job runs every day at the top of every hour. - Click Schedule.
View Scheduled Jobs
- Navigate to the Accord Admin tab in Accord Sync app. Click on the Sync Integrity tab.
- Click on Currently Scheduled Jobs.
A modal should appear with a list of all the scheduled jobs from Accord. The name will include details like the name of the job the user entered, the QuickBooks objects that will be validated, and the QuickBooks Company Id.
Configure Flow to Handle Updates to the Accord Record Status
- Navigate to Setup.
- Go to Home > Process Automation > Flows in Setup.
- Click New Flow.
- Configure the Start of the flow:
- Select the Accord Record Status object.
- Trigger the flow when A record is created or updated.
- Set the following entry conditions which should all be met (AND):
- Field:
appclipse__QB_ID__c
Operator:Is Null
Value:False
- Field:
appclipse__Status__c
Operator:Is Null
Value:False
- Field:
appclipse__Type__c
Operator:Is Null
Value:False
- Field:
- Run the flow for updated records every time a record is updated and meets the condition requirements.
- Optimize the flow for Actions and Related Records.
- Configure Decision component.
Label:Check Status
API Name:Check_Status
Outcomes: - Add a Formula variable:
API Name:QB_ID
Description:QuickBooks Id
Data Type:Text
Formula:RIGHT( {!$Record.appclipse__QB_ID__c}, LEN({!$Record.appclipse__QB_ID__c}) - FIND( "-", {!$Record.appclipse__QB_ID__c}) - 1- len( {!$Record.appclipse__Type__c}) )
- Add a Create Records component to the QBO Record Created outcome:
- Add a Create Records component to the QBO Record Updated outcome:
- Add a Create Records component to the QBO Record Deleted outcome:
- Do not add any action under the Default Outcome path.
- Save the flow.
- Activate the flow.
Running the Job Manually (Developers ONLY)
String companyId: The Id of the QuickBooks company
List<String> objects: A list of the QuickBooks entities
Datetime since: The date/time used to check for changes made since then
runSyncIntegrityValidation(String companyID, List<String> objects, Datetime since)
Example – This will validate changes made to Customers made in the last 100 daysappclipse.AccordGlobalAPI.runSyncIntegrityValidation('4620816365213778520', new List<String>{'Customer'}, ( DateTime.newInstance((Date.today() - 100), Time.newInstance(0,0,0,0))));