Earmark business events
This page is for administrators and integration developers who connect other systems to Earmark through the standard business events of Dynamics 365 Finance and Supply Chain Management. Earmark ships 26 business events that announce what happened to deals, price builds, accruals, claims, vendor deals and the platform, each one sent only after the act it describes has been saved. You decide which of them leave the system twice over: with the event switches in Earmark parameters, and by activating each event for a legal entity and an endpoint in the standard Business events catalog. Runs: by itself, right after the act that raises the event commits. Set up by: Accounting manager (the switches in Earmark parameters) and System administrator (the catalog). Watched by: the integration developer and the people who work Earmark execution exceptions.
Why it exists
Other systems often need to know when deal money changes state: a deal goes live, an order line is priced with deal money, an accrual posts, a claim is approved, a customer asks how to be paid. Polling Earmark's tables for that is slow and fragile. Each business event carries the facts of one act as a payload, so a subscriber (Power Automate, Azure Service Bus, Event Grid or another endpoint the catalog supports) can act on it straight away.
Because an event is sent only after the act commits, a subscriber never hears about an act that was rolled back, and an endpoint that is down can never refuse or undo the act.
When it runs
- An act that has an event (approving a deal, accepting a price build, posting a movement, generating a claim and so on) commits its own work first.
- If the event's switch is on, Earmark prepares the payload and waits for the commit. If the act rolls back, nothing is sent.
- After the commit, Earmark hands the event to the standard business events framework, which sends it to every endpoint the event is activated for in that legal entity.
- An act carried out when no transaction is open sends its event at once, in a separate session.
There is no batch job to schedule on the Earmark side.
Settings
| Setting | Where | Default | Effect |
|---|---|---|---|
| Publish deal events | Earmark > Setup > Earmark parameters, Events tab | Yes | Governs 17 events: the seven deal events, Earmark execution exception created, the three price build-up events, the four vendor deal events, License state changed and Migration batch certified. Its help text names only the first eight; the other nine have no switch of their own in this release and follow this one. |
| Publish accrual events | Earmark parameters, Events tab | Yes | Governs the three accrual events. |
| Publish Earmark claim events | Earmark parameters, Events tab | No | Governs the six claim events. Off at install, so no claim event is sent until you switch it on. |
| Activation of each event | System administration > Setup > Business events > Business events catalog | Not active | An event is sent only for the legal entities and endpoints it is activated for. |
Both have to say yes before anything leaves: a switch that is off stops the event before the framework is asked, and an event that is not activated is not sent by the framework. The switches are per company, like the rest of Earmark parameters; see the configuration reference.
What it does
- The act commits. For example, a deal's status commits as Approved.
- Earmark checks the event's switch for the company. If it is off, nothing more happens and no row is raised.
- Earmark packs the payload from the record the act changed. For License state changed and Migration batch certified only the key is packed, and the record is read again when the event is sent.
- After the commit, Earmark calls the standard business events framework to send the event. From that point, delivery to the endpoint is the framework's.
- If the send throws, Earmark writes one row to Earmark execution exceptions: "The Earmark business event %2 could not be published. Earmark event ID %1. %3". The act stays exactly as it was saved.
- The one exception: if Earmark execution exception created cannot be sent, no row is raised (a row would announce itself again). The infolog says "The Earmark business event %1 could not be published and no execution exception was raised for it, because raising one is what produces this event. %2".
Every payload carries an EarmarkEventId. For the deal, price build-up, accrual, claim and vendor events it is made of the subject, the act and the moment it happened. Three events differ: Earmark execution exception created uses the exception ID and the act, with no moment; License state changed uses the product code and the time of the last successful license check; Migration batch certified uses the batch ID and the certification time. A retry of a deal, accrual or migration event re-sends the same id, so a subscriber can recognize and drop a duplicate. A retry of License state changed builds the id from the current last successful check, so it carries a new id if a later check has succeeded. Earmark execution exception created is never retried.
Before it can run
- Rebuild the catalog after you install or update Earmark: System administration > Setup > Business events > Business events catalog, Manage > Rebuild business event catalog.
- Set up an endpoint in the catalog for the system that listens.
- Activate the events you need. In the catalog, the Earmark events have business event IDs starting
with
MGCEarmark(see the table below). Select Download schema if your system needs the payload schema, then Activate the event for each legal entity and endpoint. - Check the switches on the Events tab of Earmark parameters, in every company that should send. Switch Publish Earmark claim events on if you activated claim events.
Activating events needs the System administrator role or the Business events security role; no Earmark duty grants it. The switches are changed by the Accounting manager or the System administrator. See also Installation guide: business events.
What goes in and what comes out
The events
26 classes in Earmark extend the standard business event base class, one per event. The Name is what the Business events catalog shows; the description column quotes the opening of the catalog description. In the catalog's category column, the three price build-up events sit with sales orders and the other 23 under the general category.
| Business event ID | Name | Description in the catalog (opening) | When it is raised | Switch |
|---|---|---|---|---|
MGCEarmarkDealSubmitted | Earmark deal submitted | "Raised after an Earmark deal has been submitted to the deal approval workflow and its status has committed as Pending approval." | A deal is submitted for approval. | Publish deal events |
MGCEarmarkDealApproved | Earmark deal approved | "Raised after an Earmark deal has completed its approval workflow and its status has committed as Approved." | The deal approval workflow approves the deal. | Publish deal events |
MGCEarmarkDealReturned | Earmark deal returned | "Raised after an Earmark deal has left Pending approval and returned to Planning, either because an approver rejected it or because its author recalled it." | A deal is rejected or recalled; ReturnKind says which. | Publish deal events |
MGCEarmarkDealAmended | Earmark deal amended | "Raised after an approved amendment has been applied to a live Earmark deal." | An approved amendment is applied. | Publish deal events |
MGCEarmarkDealCancelled | Earmark deal canceled | "Raised after an Earmark deal has been canceled - the never-used ending, available only while nothing references the deal." | A deal is canceled. | Publish deal events |
MGCEarmarkDealClosed | Earmark deal closed | "Raised after an Earmark deal has been closed." | A deal is closed. | Publish deal events |
MGCEarmarkDealAborted | Earmark deal aborted | "Raised after an Earmark deal has been aborted." | A deal is aborted. | Publish deal events |
MGCEarmarkExecutionExceptionCreated | Earmark execution exception created | "Raised after a row has been written to the Earmark execution-exceptions workbench, which is what happens when an Earmark step malfunctioned rather than declining." | A workbench row is written while no transaction is open (see Effects below). There is no event for a resolved or dismissed row. | Publish deal events |
MGCEarmarkLinePriceBuilt | Earmark line price built | "Raised when an order line's price has been built and its deal money committed." | A price build is accepted: Build price, the buildPrice service, inbound auto-pricing, headless auto-attach or a sales-triggered vendor accrual. | Publish deal events |
MGCEarmarkLinePriceUnbuilt | Earmark line price unbuilt | "Raised when a built line price has been undone: its accrual instances are withdrawn, the line's price is restored to what it was before the build, and the build is retired." | A build is unbuilt. | Publish deal events |
MGCEarmarkLinePriceStaleFlagged | Earmark line price flagged stale | "Raised when something on the order line or its header has changed under a built price…" | Earmark flags a built line as stale. | Publish deal events |
MGCEarmarkAccrualAccrued | Earmark accrual accrued | "Raised after deal money has been accrued against a source line and the movement has committed." | An accrual movement, or one half of an adjustment split, commits. | Publish accrual events |
MGCEarmarkAccrualReversed | Earmark accrual reversed | "Raised after an accrual has been reversed - by the reverse accruals dialog, by a bulk reversal, or by a downstream act that unwound its parent." | A reversal movement commits; a bulk run sends one event per movement. | Publish accrual events |
MGCEarmarkAccrualReturned | Earmark accrual returned | "Raised after an accrual has been unwound because goods came back on a return order or a credit note." | A return reversal movement commits. | Publish accrual events |
MGCEarmarkClaimGenerated | Earmark claim generated | "Raised when accrued deal money becomes a claim." | Claim generation commits. | Publish Earmark claim events |
MGCEarmarkClaimApproved | Earmark claim approved | "Raised when a claim is approved and its customer credit has actually posted - one voucher per claim line." | The approval decision commits. See the note below the table. | Publish Earmark claim events |
MGCEarmarkClaimAdjusted | Earmark claim adjusted | "Raised when an accrual is split into an adjusted portion and a remainder." | An accrual is adjusted; the claim fields are empty and the accrual fields identify it. | Publish Earmark claim events |
MGCEarmarkClaimReversed | Earmark claim reversed | "Raised when a claim is reversed and its money re-accumulated." | An approved claim is reversed. | Publish Earmark claim events |
MGCEarmarkClaimSettlementPreferenceRecorded | Earmark claim settlement preference recorded | "Raised when a customer tells us how they want an approved claim settled - by cheque, or applied on account." | A settlement preference is recorded; recording it twice sends two events. | Publish Earmark claim events |
MGCEarmarkClaimStatementRunEvent | Earmark claim statement run | "Raised when a claim statement has been rendered and sent." | A statement run succeeds, never on a failure. | Publish Earmark claim events |
MGCEarmarkMirrorPaired | Earmark mirror paired | "Published when one trigger-driven movement posts on both sides of a mirror in the same post-commit unit…" | The vendor side of a mirrored movement is paired. | Publish deal events |
MGCEarmarkMirrorConditionChanged | Earmark mirror condition changed | "Published when a mirror pairing's condition actually transitions - in step to out of step, out of step to capped, and so on." | A mirror's condition changes, never when a re-evaluation leaves it as it was. | Publish deal events |
MGCEarmarkThirdPartySettled | Earmark third-party settled | "Published when a third-party (Shape 4) accrual is settled journal-less against a posted vendor invoice reference." | A sales-triggered vendor accrual is settled by reference. | Publish deal events |
MGCEarmarkVendorSettlementRunCompleted | Earmark vendor settlement run completed | "Published when a periodic vendor settlement run completes." | A vendor settlement run completes, never for a preview. | Publish deal events |
MGCEarmarkLicenseStateChanged | License state changed | "Announces that one product's cached entitlement verdict has moved - Entitled, Grace or Lapsed." | The license verdict changes. | Publish deal events |
MGCEarmarkMigrationBatchCertified | Migration batch certified | "Announces that a cut-over migration batch has been Certified…" | A migration batch is certified. | Publish deal events |
About Earmark claim approved. Its catalog description says it is not raised until the credit has posted. In this release it is raised when the approval decision commits, while the claim's posting is still pending, and for a vendor claim before accounts payable has posted any credit. Do not read it as "the customer has been credited": read the payload's PostingStatus (Posting pending when sent) before treating the credit as real, and see Integration developer: I want to know when an approved claim has been credited.
The main payload fields
Each event of a family carries the same fields; a field that does not apply to the act is empty. The standard framework adds its own fields to every event as well (such as BusinessEventId, EventId, EventTime and ControlNumber).
| Events | Payload fields |
|---|---|
| The seven deal events | EarmarkEventId, EventType, DealId, DealRecId, DealName, DealGroupId, DealOwner, DealStatus, Module, Shape, CurrencyCode, ValidFrom, ValidTo, LifetimeCap, ClaimableBy, AccountSource, ReturnKind, ReasonCode, ReasonNote, AmendmentRecId, AmendmentSequence, Actor, ActDateTime, Company |
| Earmark execution exception created | EarmarkEventId, ExceptionId, Operation, SourcePackage, DocumentType, DocumentRecId, DocumentNaturalKey, ExceptionStatus, Message, Company, RaisedDateTime, Actor |
| The three price build-up events | EarmarkEventId, LinePriceRecId, BuildNumber, Company, OrderId, LineNum, InventTransId, ItemId, CurrencyCode, BasePriceCur, OverBasisCur, DealMoneyCur, AllowanceCur, UnitPriceCur, PriceModeSummary, BuildState, Act, ReasonCode, Note, StaleReasons, Actor, ActDateTime |
| The three accrual events | EarmarkEventId, AccrualTransId, AccrualTransRecId, Company, DealId, DealRecId, AccrualInstanceId, AccrualInstanceRecId, InventTransId, MovementType, MovementOrigin, TransState, PostingStatus, AmountCur, CurrencyCode, AmountMST, ExchRate, ExchRateDate, Qty, ParentAccrualTrans, JournalNum, Voucher, PostingDate, CounterpartyAccount, IdempotencyKey, Actor, ActDateTime |
| The six claim events | EarmarkEventId, ClaimRecId, ClaimId, Company, CounterpartyType, CounterpartyAccount, InvoiceAccount, CurrencyCode, Status, PostingStatus, TotalAmountCur, TotalAmountMST, LineCount, ClaimReference, AccrualTransRecId, AccrualTransId, Preference, PreferenceSource, StatementRunId, AsOfDate, AvailableBalance, Act, ReasonCode, Note, Actor, ActDateTime |
| The four vendor deal events | EarmarkEventId, Company, Act, Actor, ActDateTime, MirrorLinkRecId, CustomerInstanceId, VendorInstanceId, Condition, PreviousCondition, DivergenceAmount, CappedHeadroom, MovementType, CustomerVoucher, VendorVoucher, PairKey, ThirdPartySettlementRecId, VendorInvoiceVoucher, VendorInvoiceId, SettledAmount, CurrencyCode, AccrualInstanceId, AccrualTransId, VendorSettlementRunId, RunStatus, ClaimCount, ExceptionCount, TotalAmount |
| License state changed | EarmarkEventId, ProductCode, Verdict, Source, GraceEndDate, LastSuccessfulCheckDateTime |
| Migration batch certified | EarmarkEventId, MigrationBatchId, CertifiedBy, CertifiedDateTime |
A few fields worth knowing:
- An accrual amount is the applied amount after any cap or minimum and maximum clipping, positive for a debit and negative for a credit, with the accounting amount and the rate beside it. PostingStatus says whether its journal has posted yet.
- A reversal's amount is taken from the movement it reverses, so an accrued and reversed pair nets to zero on ParentAccrualTrans.
- StatementRunId identifies the run, not a statement number. Do not print it on anything a customer sees.
Watching it
- Earmark > Inquiries and reports > Earmark execution exceptions, filtered on the operations Event publish (deal, claim, price build-up and vendor events), Pulse emit (accrual events), License Pulse emit and Migration Pulse emit. A row's message carries the EarmarkEventId of the event that failed.
- The Business events catalog shows which events are active for which legal entity and endpoint. Anything that goes wrong after Earmark has handed an event to the framework is reported by the framework, not by Earmark.
When it fails
A failed send is one Open row on Earmark execution exceptions. The act it announces is never undone. Fix the cause (usually the endpoint, its credentials or the catalog activation), switch to the row's Company, then:
| Row | What Retry does |
|---|---|
| Event publish with Source document type Deal | Re-sends the deal event with the same EarmarkEventId and time, built from the deal as it is now. Earmark deal amended is not re-sent: re-apply the act if the event is still needed, then dismiss the row. |
| Event publish with any other Source document type (claim, price build-up and vendor events) | Cannot re-send it. Dismiss the row with a reason and do not retry it. Retry looks for a deal with the row's record ID: for most of these events it finds no matching act and the row goes back to Open. For Earmark claim approved, whose act has the same name as the deal's, a deal that happens to share the claim's record ID gets its Earmark deal approved event re-sent, and the row is marked Resolved. |
| Pulse emit | Re-sends the accrual event with the same EarmarkEventId. |
| License Pulse emit | Re-sends License state changed with the license verdict as it is now. |
| Migration Pulse emit | Re-sends Migration batch certified for the batch. |
Two things to know before you retry an event row:
- The switch must be on. With the event's switch off, Retry sends nothing and still marks the row Resolved.
- A failed re-send moves to a new row. If the send fails again, the row you retried reads Resolved and a new Open row records the new failure.
Re-sending is safe for your money: an event moves nothing in Earmark. A subscriber may receive the same event twice, with the same EarmarkEventId, and should ignore the second. The full workbench procedure is on Earmark execution exceptions: background steps and Retry.
Effects on the rest of Earmark
- None on the act. Sending, failing to send or re-sending an event never changes the deal, build, movement or claim it describes.
- Rolled-back acts send nothing, so every event describes something that was saved.
- Workbench rows announce themselves, mostly. With Publish deal events on and the event activated, a new workbench row sends Earmark execution exception created straight away, in the session that wrote it, so a monitoring system can alert without polling. A row written while a transaction is open sends nothing (the event does not wait for the commit), so do not rely on the event alone: also watch the workbench.
- Switches are read at the moment of the act. Switching a family on does not send events for acts that happened while it was off.
Related
- Installation guide: business events
- Integration developer: what you do and where
- I want to choose which business events Earmark publishes
- Page reference: Earmark parameters
- Earmark execution exceptions: background steps and Retry
- Inbound auto-pricing and headless auto-attach on purchase lines
- API reference
- Configuration reference