Track CDS declaration status by MRN
Once a declaration is sent, someone has to keep checking it: has it been accepted, released or rejected? This recipe keeps a table of open MRNs, asks HMRC about each one on a schedule and brings a person in only when something changed.
It works for declarations from any system, as long as HMRC shows them to the trader on the connection.
If an automation sends the declaration with Send CDS declaration, that block already waits for HMRC’s decision, so you need this only for its Timed out exit or for declarations sent elsewhere.
1. Keep a table of open declarations
Section titled “1. Keep a table of open declarations”Create a reference table with the MRN as its key, a column for the last status you saw and a yes or no Open column. Add a row whenever a declaration is sent, using Write Reference Table from the automation that sends it, or a Webhook from the system that does.
Or ask HMRC what is open
Section titled “Or ask HMRC what is open”Instead of keeping the table yourself, Search CDS declarations lists the trader’s declarations HMRC holds, each with its status. With Status set to Not cleared yet it returns what is still open, so a scheduled run can reconcile HMRC’s list with your own records, and feed For each item in the next step. It searches the last 30 days unless you set From and To, and HMRC keeps declarations for 180 days. To compare a whole month with your records, see Reconcile CDS declarations.
2. Check each one on a schedule
Section titled “2. Check each one on a schedule”Start with a Schedule trigger and Read Reference Table, with Only rows where set to Open is yes, and At least set to 0, so a quiet hour with nothing open isn’t a failure. Add For each item, and connect Get CDS declaration status to its Item exit, with MRN from the Current item.
The block only reads, so a draft run calls HMRC for real. A sandbox connection reads HMRC’s test environment.
3. Act on what changed
Section titled “3. Act on what changed”Status under Declaration is the furthest step HMRC reports: received, accepted, released, rejected or invalidated. Compare it with the status in your table. On a change:
- Released: tell whoever books the delivery, and take the row out of the open list.
- Rejected: raise an Approval or assign the work. See Decide who owns the work.
- Invalidated: tell whoever owns the shipment, and close the row.
- Accepted: update the row and keep checking.
The output also carries the latest version, LRN, DUCR, UCR and HMRC’s route of entry, inventory return and import clearance codes.
4. Handle the two other exits
Section titled “4. Handle the two other exits”| Exit | What it means | What to do |
|---|---|---|
| Not found | HMRC has no declaration with this MRN from the last 180 days that this trader can see | Check the MRN and the connection, with a person |
| HMRC unavailable | A timeout, network failure, rate limit or HMRC outage | Leave the row open. The next run tries again |
What goes wrong
Section titled “What goes wrong”- A trader sees only their own declarations. HMRC shows a trader only the declarations that trader submitted, so Not found can mean the wrong connection. Set up the connection as that trader, with an EORI enrolled for CDS.
- Declarations older than 180 days disappear. Close rows once they finish, or an old MRN turns into a permanent Not found.
- An expired connection. A refused authorisation fails the step and asks you to reconnect. That’s different from HMRC unavailable, and retrying won’t fix it.