Reconcile last month's CDS declarations with your records
Your records say which declarations you sent and where each one stands. HMRC’s records say what it actually holds. This recipe compares the two once a month with Search CDS declarations, so a missing, rejected or unexpected declaration reaches a person before month-end work relies on it.
Search is the only way to find declarations you don’t already have an MRN for. A declaration sent from other software never passes through Lainstack, so no other block knows it exists. Search lists it, as long as the trader on the HMRC connection submitted it.
1. Keep your own records in a table
Section titled “1. Keep your own records in a table”Keep a reference table of the declarations you send, keyed by MRN, with a column for the last status you saw. The table in Track CDS declaration status works as it is. Add a row from every automation that sends a declaration, with Write Reference Table.
2. Work out last month’s dates
Section titled “2. Work out last month’s dates”Start with a Schedule trigger that runs on the first day of each month. HMRC’s dates are days in YYYY-MM-DD, so:
- Current Time gives today’s Date.
- A Date Math with Input type set to Date subtracts 1 month from it: the first day of last month.
- A second Date Math subtracts 1 day from today: the last day of last month.
3. Ask HMRC what it holds
Section titled “3. Ask HMRC what it holds”Add Search CDS declarations:
- HMRC connection: the trader’s HMRC Customs Declarations connection.
- Declarations: All, or Imports or Exports to reconcile them separately.
- Status: Any, so released, rejected and invalidated declarations come back too.
- From and To: the two dates from step 2.
Each declaration comes back with its MRN, LRN, DUCR, declaration type, status (received, accepted, released, rejected or invalidated), dates and HMRC’s route of entry and import clearance codes.
HMRC answers a page at a time. Pages to read under Limits reads 5 pages by default, up to 20. When Truncated is true, more matched than the step read: raise Pages to read, or run the search weekly or per declaration category instead.
HMRC unavailable means a timeout, network failure, rate limit or HMRC outage. Nothing is wrong with the search: retry the run later. See Recover failed runs.
4. Compare HMRC’s list with yours
Section titled “4. Compare HMRC’s list with yours”Add Read Reference Table for your table, with At least set to 0. Then add Checklist with one check, Compare two lists, row by row:
- Observed list: the search’s Declarations, named “HMRC”.
- Expected list: your table’s rows, named “Our records”.
- Key: the MRN in both.
- Columns: the status in both, so a declaration HMRC rejected or invalidated while you still show it as open is a finding. Write statuses into your table in HMRC’s words (received, accepted, released, rejected, invalidated) so they compare.
Decide what a row in only one list means:
- Only at HMRC: a finding. HMRC holds a declaration you have no record of: sent from other software, or by an automation that didn’t record it.
- Only in your records: a note. Your table holds every month, while the search covers only last month.
Set Ask a person to When a check fails. A month where everything agrees ends there. See Reconcile two documents or lists.
Keep HMRC’s list too
Section titled “Keep HMRC’s list too”To keep each month’s list for reports, add Write Reference Table after the search, into a table keyed by MRN. Under Build rows, use For each on the search’s Declarations, with one cell per column, such as MRN, type, status and accepted date. The table must be set up to update rows by its primary key, and one step writes at most 1,000 rows.
What goes wrong
Section titled “What goes wrong”- Declarations someone else submitted. HMRC searches only the declarations the trader on the connection submitted. A declaration an agent submitted under their own identity doesn’t appear, even when it names your trader.
- Older declarations. HMRC searches only the last 180 days. Run the reconciliation every month, not once a year.
- A truncated search. The declarations the step didn’t read are missing from the comparison. Raise Pages to read or search a shorter period.
- A wrong date. A From or To HMRC can’t read fails the step with HMRC’s message.
- An expired connection. A refused authorisation fails the step and asks you to reconnect. Retrying won’t fix it.