Sync SQL Server invoice data on schedule

Recipe ToolsMarketingWorkatoDatabase

What it does

When a scheduled time arrives, this automation queries the Medius_Inv_Mst table in SQL Server to retrieve invoice records. It updates or inserts batch header level details and logs the job progress to a report.

Who it's for

Accounting teams who need to sync invoice data from SQL Server on a recurring schedule without manual intervention.

How teams use this

Sync invoices on a daily schedule

Run the SQL Server sync every morning at a set time so invoice batch headers stay current without manual updates. The team sees the job report each day to confirm success.

Route invoices to different teams by time

Check the scheduled time and only proceed if it matches a specific window, so invoices are synced during business hours. Other times the job stops without processing.

Add invoice line item details to the sync

Include a second SQL Server query to also select and update line item rows alongside the batch headers. The job report then logs both the header and line item sync results.

How it works

  1. Run on a custom schedule. This automation starts at a scheduled time each day or week, checking if the time contains T04 to determine whether to proceed with the sync.
  2. Select invoice rows from SQL Server. Query the Medius_Inv_Mst table in SQL Server to retrieve the invoice records that need to be synced to the batch header level.
  3. Update or insert batch header details. Write the batch header level invoice details back to SQL Server, creating new records or updating existing ones as needed for the sync.
  4. Log job completion to report. Record the sync results in a job report so the team can track when the invoice data was last updated and whether any errors occurred during processing.