Skip to content

When a CDS declaration changes

Starts an automation each time HMRC reports news on a declaration this connection sent: accepted, rejected, held, released, invalidated, tax and more.

@lainstack/hmrc/cds-declaration-changed · Triggers · Available on Lainstack Cloud

Use When a CDS declaration changes to start a run each time HMRC reports news on a declaration your HMRC connection sent. The run can finish as soon as it sends, and this trigger picks up what HMRC says later: acceptance, clearance, a hold for a control or documents, an invalidation weeks later, a payment reminder or the goods leaving the UK.

Good to know:

  • It covers what this connection sent with Send CDS declaration and Update CDS declaration (arrival, amendment, cancellation). HMRC’s answer to an uploaded document isn’t an event. Declarations sent by other software can’t be followed: HMRC sends their news to that software.
  • Pick the Events that start a run. Every event is picked to begin with. Each event HMRC reports starts one run, which counts as one run.
  • News leaves on Declaration changed, which always carries the MRN, so later steps can use it. News that carries no MRN leaves on No MRN yet.
  • The run gets the MRN, the LRN, the event and a plain-English summary. A rejection lists HMRC’s error codes with an explanation of each; a tax calculation lists its tax lines and total.
  • HMRC’s news can arrive in any order (the tax calculation can come before or after the acceptance), and a run started for one event doesn’t wait for the others. Issued at tells which is newer.
  • Only automations published before HMRC spoke start. News on a declaration is checked about once a minute.
  • An automation in another workspace never hears about your declarations, even on the same Lainstack install.
Setting Key Type Details
HMRC connection (required) credentialId Connection The HMRC connection that sent the declarations to follow. At most 160 characters.
Events events List A run starts for each of these that HMRC reports. Every event to begin with. At most 40 items.
Output Path Type
Data > Event payload.data.event Choice
Data > Summary payload.data.summary Text
Data > Message Type payload.data.messageType Text
Data > Label payload.data.label Text
Data > MRN payload.data.mrn Text
Data > LRN payload.data.lrn Text
Data > Version ID payload.data.versionId Text
Data > Issued At payload.data.issuedAt Text
Data > Accepted At payload.data.acceptedAt Text
Data > Request Accepted payload.data.requestAccepted Yes or no
Data > Errors payload.data.errors List
Data > Tax Lines payload.data.taxLines List
Data > Tax Total > Amount payload.data.taxTotal.amount Text
Data > Tax Total > Currency payload.data.taxTotal.currency Text
Data > Additional Information payload.data.additionalInformation List
System > Connection ID payload.system.connectionId Text
System > Environment payload.system.environment Text
System > Conversation ID payload.system.conversationId Text
System > Notification ID payload.system.notificationId Text
System > Received At payload.system.receivedAt Text
Exit Port Notes
Declaration changed out
No MRN yet noMrn

Last updated: