Earmark Integration Services: API Reference
Applies to Earmark release 1.0 for Dynamics 365 Finance and Operations 10.0.47, in the builds after 1.0.47.2. Where build 1.0.47.2 behaves differently, the section says so.
Earmark publishes two JSON custom-service operations for external systems. They are the product's whole service surface: there are no other Earmark service operations, and deals, claim submission, settlement and reporting are done in the client or read through data entities (see Data entity reference).
| Operation | What it does |
|---|---|
buildPrice | Builds the Earmark price on one sales order line or purchase order line: base price, over-basis and the eligible deal money, the accrual instances the build commits, and the line's own unit price. The same act as Build price on the order line. |
approveClaim | Approves one claim that is pending approval and raises its approval credit. The same approval routine that runs when an approver uses Approve on the claim's workflow work item. |
Both operations call the same orchestrator as the buttons in the client, so they apply the same rules and return the same verdicts. A policy outcome (a "verdict") comes back in an HTTP 200 answer, never as an HTTP error. An HTTP error means the call did not run, or something malfunctioned.
Table of Contents
- At a glance
- Authentication
- Security: what the service user needs
- Endpoint pattern
- Company context
- Common response format
- Decisions and malfunctions
- 1. buildPrice
- 2. approveClaim
- Rate limiting and throttling
- Contract stability
- Related documents
- How this reference was verified
At a glance
buildPrice | approveClaim | |
|---|---|---|
| Endpoint | POST https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkBuildPriceService/buildPrice | POST https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkApproveClaimService/approveClaim |
| Service (AxService) | MGCEarmarkBuildPriceService | MGCEarmarkApproveClaimService |
| X++ method bound to the operation | MGCEarmarkBuildPriceService.buildPriceWire | MGCEarmarkApproveClaimService.approveClaimWire |
Request contract (_request) | MGCEarmarkBuildPriceWireRequest | MGCEarmarkApproveClaimWireRequest |
| Result contract | MGCEarmarkBuildPriceWireResult | MGCEarmarkApproveClaimWireResult |
| Verdict contract | MGCEarmarkWireVerdict | MGCEarmarkWireVerdict |
| Delegates to | MGCEarmarkBuildPriceService.buildPrice → MGCEarmarkPriceBuildOrchestrator::build | MGCEarmarkApproveClaimService.approveClaim → MGCEarmarkClaimApprovalOrchestrator::approveOutsideWorkflow |
| Privilege | MGCEarmarkBuildPricePriv (Build line prices) | MGCEarmarkClaimApprovePriv (Approve and reject Earmark claims) |
| Idempotency | IdempotencyKey (required) | ClaimId + WorkflowInstanceId (both required) |
| Server-side re-check | Access to the Build price action menu item (MGCEarmarkPriceBuild) | Holds the Approve Earmark claims duty, plus segregation of duties |
The service classes also carry public buildPrice and approveClaim methods that take Earmark's internal
request classes. Those methods are not service operations: each AxService binds only its ...Wire
method, which takes and returns the primitive wire contracts documented here.
Authentication
Earmark uses the standard Finance and Operations service authentication: an OAuth 2.0 bearer token from Microsoft Entra ID, obtained with the client credentials grant.
- Register an application in the Microsoft Entra tenant of the Finance and Operations environment, and give it a client secret or certificate.
- Map it to a user in Finance and Operations. Go to System administration > Setup > Microsoft Entra ID applications, add a row with the application's Client Id, a Name, and the User ID of the Finance and Operations user the calls run as.
- Give that user the security roles described in the next section.
Every call runs as the mapped user. That user's roles decide whether the call is allowed, that user is recorded as the person who built the price or approved the claim, and that user is the one segregation of duties is judged against. The request never names an actor or an approver.
Token request (Entra v2 endpoint):
POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id={clientId}
&client_secret={clientSecret}
&scope=https://{environment}/.default
The v1 endpoint (POST https://login.microsoftonline.com/{tenantId}/oauth2/token with
resource=https://{environment}) works too; Earmark's own integration test client uses that form.
Send the token on every call:
Authorization: Bearer {access_token}
Content-Type: application/json
Accept: application/json
Licensing refuses only a claim approval, and only at the block date on production. buildPrice never
checks the license: existing deals keep pricing whatever the license says. approveClaim is refused on a
production environment once Earmark's license has reached its block date: a claim that is Pending approval
gets the Blocking verdict MGCEarmark_Vrd_LicenseBlocked and is left as it was, workflow included, so the
same call approves it once the license is restored. A claim already approved is still answered
AlreadyApproved, and its credit keeps posting. Other environment types only warn and never refuse, and a
fault inside licensing refuses nothing. Apart from the block, a license in grace or lapsed shows a banner in
the workspace and a watermark on the internal copy of a claim statement; it refuses no call. What else the
block refuses for an integration (a data management import of a new deal, for example) is in
Integration developer.
(Changed after build 1.0.47.2: in that build licensing refused nothing.)
Security: what the service user needs
Security follows the platform model: the service operation is an entry point on a privilege, duties hold privileges, and roles hold duties. Each operation's entry point sits on the privilege that already grants the same act in the client, so being allowed to call the operation and passing Earmark's own server-side check come from one grant.
| Operation | Privilege (service operation entry point, Invoke) | Duties that hold the privilege | Shipped roles that hold the duty |
|---|---|---|---|
buildPrice | MGCEarmarkBuildPricePriv - Build line prices (entry point MGCEarmarkBuildPriceService_buildPrice) | MGCEarmarkBuildLinePricesDuty - Build line prices; MGCEarmarkBuildPurchasePriceDuty - Build Earmark purchase prices | Sales clerk (TradeSalesClerk) and Sales manager (TradeSalesManager), by role extension, hold Build line prices; Purchasing agent (VendPurchasingAgent) and Purchasing manager (TradePurchasingManager), by role extension, hold Build Earmark purchase prices |
approveClaim | MGCEarmarkClaimApprovePriv - Approve and reject Earmark claims (entry point MGCEarmarkApproveClaimService_approveClaim) | MGCEarmarkApproveClaimsDuty - Approve Earmark claims (its only privilege) | Earmark claims approver (MGCEarmarkClaimsApprover) only; no standard role carries it |
Earmark then re-checks on the server, against the session user, on every call:
buildPriceaskshasMenuItemAccessfor the action menu itemMGCEarmarkPriceBuild(the Build price button), which the same privilege grants. It does not check which duty the privilege came through, so either duty lets the user build a price on a sales line or a purchase line. The menu item carries Earmark's product feature toggle, so the check also fails when no Earmark module is switched on in the legal entity. See buildPrice security.approveClaimasks whether the user holds theMGCEarmarkApproveClaimsDutyduty through a role assigned to them, and runs the segregation-of-duties verdict. A custom duty that holds the privilege but is notMGCEarmarkApproveClaimsDutylets the platform route the call but is refused by Earmark. See approveClaim role and SoD re-check.
Practical consequences:
- Assign the roles to the user the Entra application is mapped to, like any person: Sales clerk or Sales
manager (or another role holding Build line prices or Build Earmark purchase prices) for
buildPrice, Earmark claims approver forapproveClaim. - A user with the System administrator role passes the
buildPricemenu-item check (platform behavior), but is still refused byapproveClaimunless it is also assigned a role holding Approve Earmark claims. - If one integration both prices lines and approves claims, consider two Entra applications mapped to two users. The approving user must not be the user who generated or submitted the claim, and Earmark seeds assignment-time segregation rules that pair Approve Earmark claims against Process Earmark claims, Approve Earmark deals, Reverse Earmark accruals and Unbuild line price.
The full role, duty and privilege catalog is in Security reference.
Endpoint pattern
POST https://<environment>/api/services/MGCEarmarkServiceGroup/<Service>/<operation>
<environment> is the Finance and Operations host name, for example contoso-prod.operations.dynamics.com.
| Service group | Service | Operation |
|---|---|---|
MGCEarmarkServiceGroup | MGCEarmarkBuildPriceService | buildPrice |
MGCEarmarkServiceGroup | MGCEarmarkApproveClaimService | approveClaim |
The service group is set to AutoDeploy Yes, so both operations are published when Earmark is
deployed. A GET on the group, service or operation URL returns the platform's service metadata
(platform behavior; not exercised by Earmark's test suite).
Request body. The body is a JSON object with one member, _request, which is the name of the X++
parameter of both operation methods. Its value is the request contract:
{ "_request": { "...": "..." } }
Send member names exactly as this reference lists them. They are the X++ DataMember names and are a
published contract. A member you leave out takes its type's default ("", false or 0), which is how the
defaults in the request tables below arise. A body with no _request member is treated as an empty request
and refused with the verdict for the first required member it lacks.
Company context
Both requests carry a Company member.
- Blank or omitted: the call runs in the session company, which for a service call is the default company of the Finance and Operations user the Entra application is mapped to.
- A legal entity id: it must match an existing legal entity id exactly. Letter case and surrounding spaces
are ignored, and the call runs under the legal entity's own spelling (
usmfruns inUSMF). A value that only matches after being cut short (longer than any company id) is not accepted. - No match: the call is refused with the Blocking verdict
MGCEarmark_Vrd_ConduitCompanyNotFoundbefore anything else is read.
Once resolved, the whole operation runs inside that legal entity: the order line or claim is looked up there, and that company's Earmark parameters, module switches and posting setup apply. Whether the user may work in that legal entity is the platform's decision (the answer for an existing legal entity the user has no access to is not verified).
Common response format
Each operation returns a flat JSON object (its members are listed in the operation sections). Both carry a
Verdicts array. It is never null: it is an empty array when nothing was decided.
The verdict object (MGCEarmarkWireVerdict)
| Member | JSON type | Meaning |
|---|---|---|
Id | string | The verdict's label id, for example MGCEarmark_Vrd_ClaimNotFound, without the @MGCEarmark: prefix. It is the same in every language. Branch on this. |
Type | string | Blocking: the verdict stopped the act, and nothing was done by this call. Informational: the act went ahead (or the call was answered), and the verdict is something to read. These are the only two values. |
Message | string | The sentence in the service user's language, exactly as it was stated, so it matches what the infolog and Earmark's records show. Meant for logs and people. |
Verdicts are listed in the order they were stated. A refusal can carry several Blocking verdicts at once (for example, one per failing claim line).
$id members
The platform's JSON serializer adds a "$id" member to every object in the answer, including each verdict
object. It is not part of Earmark's contract: ignore it, and in general tolerate members you do not model.
Decisions and malfunctions
| What you get | What it means | What to do |
|---|---|---|
HTTP 200, no Blocking verdict | The act was done, or the call was a safe repeat of one that was. | Read the result. |
HTTP 200, one or more Blocking verdicts | A policy decision. Nothing was done by this call. | Act on the verdict (each table below says how). Do not retry blindly: the same request is refused the same way until the cause changes. |
| HTTP 401 | No token, or the token expired. | Get a new token and resend. |
| HTTP 429 | Platform throttling refused the call before it ran. | Wait for Retry-After and resend the same body. |
| Another HTTP error (typically 500) | The call did not run, or it malfunctioned: the platform refused it (for example, a missing privilege or a body that does not deserialize), or an X++ exception escaped the operation. | Read the error body (the platform's error JSON, typically with Message, ExceptionType and ActivityId; shape not verified). Resending the same body is safe for both operations, because both are idempotent (see each operation). |
How each operation sorts its outcomes:
buildPricereturns each refusal under its own verdictId, and throws a malfunction. The build orchestrator states every refusal it decides (module off, already built, outside the edit window, deal no longer available, the price composer's refusals, the purchase-line refusals) as a verdict before it stops, and the operation returns those verdicts, together with any Informational verdict stated before the refusal, with HTTP 200. Anything the build stops on without stating a verdict is a malfunction (anMGCEarmark_Err_...message such as a line with no inventory transaction origin or an idempotency key already used by another build, the order line's own validation refusing the price write, or a platform error) and reaches the caller as an HTTP error. A malfunction writes nothing and raises no workbench row: the caller holds the retry, and repeating the same body is safe.approveClaimcatches nothing. Its refusals are verdicts because the approval routine returns them as verdicts; any exception, including a failed approval journal, reaches the caller as an HTTP error. See approveClaim failures.
Changed after build 1.0.47.2: in that build buildPrice answered every error raised while building,
refusal or malfunction alike, with the one Blocking verdict MGCEarmark_Vrd_PriceConduitRefused quoting the
session's last infolog text. That id is no longer returned.
1. buildPrice
Service: MGCEarmarkBuildPriceService · Service group: MGCEarmarkServiceGroup · Method:
buildPriceWire
What it does
The caller names one order line by legal entity, line table and lot ID (InventTransId). Earmark builds its
price through MGCEarmarkPriceBuildOrchestrator::build, the one routine behind the order line's Build
price button and the inbound pricing policy. In a single transaction it writes:
- the build (
MGCEarmarkLinePrice) and its components: the base, the over-basis when it is not zero, and one component per included deal; - one accrual instance per included deal whose shape accrues (a purchase price build-up deal moves the price and accrues nothing, so it gets no instance);
- the line's unit price (
SalesLine.SalesPriceorPurchLine.PurchPrice) when the composed unit price differs from it, with the line amount recalculated.
Either all of that is written or none of it is. After the commit Earmark writes the timeline rows, publishes
the MGCEarmarkLinePriceBuilt business event (when Publish deal events is on: the pricing events follow
that switch) and runs the third-party attach; those steps cannot change the answer. The build is recorded with build source Conduit service and the session user as the builder.
buildPrice and the inbound pricing policy are separate routes. The inbound pricing policy prices sales
lines that an integration creates through the standard sales order line entities, without a call to this
operation, and only while Inbound auto-pricing is on (Earmark parameters, Price build-up tab). That
switch ships off, and in a company that set up policy rows under an earlier build, those rows price nothing
after the update until it is switched on. buildPrice does not read the switch. Do not combine the two on the same lines: a line the policy has
already priced is refused here with MGCEarmark_Vrd_PriceAlreadyBuilt.
What the integration decides, and what it cannot.
AcceptAllEligibletrueincludes every deal that targets the line and is eligible for it.falseincludes no deal: the build then carries only the base and the over-basis, and the line still counts as built (a later build needs an Unbuild first).- The request cannot include or decline deals one by one, cannot edit a deal's amount, and can never attach a deal whose targeting does not reach the line. Those are decisions a person makes in the price builder.
- The request names no actor. The session user is always the builder.
Unit prices, deal money and allowances are amounts per price unit (the line's Price unit) in the line's currency.
Request
Contract: MGCEarmarkBuildPriceWireRequest, sent as _request.
| Member | JSON type | Required | When omitted | Rules |
|---|---|---|---|---|
Company | string | No | Session company | Legal entity id. See Company context. |
LineTable | string | Yes | "": refused (PriceConduitBadLineTable) | SalesLine or PurchLine. Letter case and surrounding spaces are ignored. Any other value is refused. |
InventTransId | string | Yes | "": refused (PriceConduitNoLine) | The order line's lot ID. Surrounding spaces are ignored. It must match the line's lot ID in full: a value the lookup could match only by cutting it short is treated as not found. |
BasePriceSupplied | boolean | No | false | true uses BasePrice as the base. false uses the line's current unit price as the base. |
BasePrice | number | When BasePriceSupplied is true | 0 | Base price per price unit, in the line's currency. Must not be negative. Ignored when BasePriceSupplied is false. |
OverBasisSupplied | boolean | No | false | true uses OverBasis. false means no over-basis (zero). |
OverBasis | number | When OverBasisSupplied is true | 0 | Over-basis per price unit, in the line's currency. May be negative (a discount belongs here, not in the base). |
AcceptAllEligible | boolean | No | false | true includes every eligible targeting deal; false includes none. |
IdempotencyKey | string | Yes | "": refused (PriceConduitNoKey) | 1 to 100 characters. Measured exactly as sent (not trimmed) and never cut short: a longer key is refused. Compared without regard to letter case. A key can be used for only one build per legal entity. See Idempotency and repeats. |
Response
Contract: MGCEarmarkBuildPriceWireResult
| Member | JSON type | Meaning |
|---|---|---|
Built | boolean | true when this call built the line, or found the build its own key made earlier. This is the one question to ask. It is false on every refusal, including when the line already carries somebody else's build. |
AlreadyBuilt | boolean | true when the call was an idempotent repeat: the existing build was returned and nothing was written. Always comes with Built true. |
LinePriceRecId | integer (64-bit) | Record id of the MGCEarmarkLinePrice row built or found; 0 when nothing was built. |
BuildNumber | integer | The build's number on the line: 1 for a first build, the next number for a rebuild after Unbuild, never reused. 0 when nothing was built. |
UnitPrice | number | The composed unit price: base + over-basis + DealMoney. This is the unit price the line now carries. |
DealMoney | number | The grossed-up deal money: the part of UnitPrice that is deal money. |
Allowance | number | The off-invoice allowance: deal money that is not in the invoiced price. |
InstanceCount | integer | How many accrual instances this call created. 0 on a repeat (AlreadyBuilt), on a refusal, and for a build with no accruing deal. |
Verdicts | array of verdict | See The verdict object. |
On a refusal both booleans are false and every number is 0.
Order of checks
Companyresolves to a legal entity, orMGCEarmark_Vrd_ConduitCompanyNotFound.IdempotencyKeyis at most 100 characters, orMGCEarmark_Vrd_PriceConduitKeyTooLong.IdempotencyKeyis not blank, orMGCEarmark_Vrd_PriceConduitNoKey.- The session user may build line prices, or
MGCEarmark_Vrd_PriceBuildNotPermitted. This is checked before any order line is read, so a caller without the right learns nothing about which lot IDs exist. LineTableisSalesLineorPurchLine, orMGCEarmark_Vrd_PriceConduitBadLineTable.InventTransIdis not blank, orMGCEarmark_Vrd_PriceConduitNoLine.- The line exists in the legal entity, or
MGCEarmark_Vrd_PriceConduitLineNotFound. - The build itself. In order: for a purchase line, it is not intercompany-sourced and not yet received; the
module for the line is switched on; the call is an idempotent repeat (answered here) or the line is not
already built; the line is inside its edit window and the base is not negative; the eligible deals are
found and the price is composed; then, inside the transaction, each included deal is locked and re-checked
to still be Approved, and the line is re-checked to have no current build, before anything is written.
Each refusal at this step comes back under its own
Id(next section); a malfunction is an HTTP error.
Verdicts
Verdicts with their own Id (stated by the service layer; branch on the Id):
Id | Type | Message (en-US; %n is filled in) | Meaning | What the caller should do |
|---|---|---|---|---|
MGCEarmark_Vrd_ConduitCompanyNotFound | Blocking | Legal entity %1 does not exist. Name the legal entity the order line or claim belongs to, or leave Company blank to use the calling user's default company. Nothing was done. | Company names no legal entity. | Correct Company, or send it blank. |
MGCEarmark_Vrd_PriceConduitKeyTooLong | Blocking | The idempotency key is %1 characters long, and the longest key Earmark keeps is %2. A longer key would be cut short, and two different keys that begin the same way would then look like a repeat of each other. Supply a shorter key. Nothing was built. | The key is longer than 100 characters. | Use a shorter key. |
MGCEarmark_Vrd_PriceConduitNoKey | Blocking | The build was refused because the request carried no idempotency key. A key is required on this operation and optional from the user interface, and the difference is deliberate: [...] Supply a key that is stable for the line and the intent - the same key on a repeat returns the existing build rather than making another. | No key was sent. | Send a key. |
MGCEarmark_Vrd_PriceBuildNotPermitted | Blocking | User %1 is not permitted to build line prices. The build duty belongs to the order desk and is assigned deliberately, and an integration identity has to be given it in the same way a person is. This check is made on the server against the signed-in user and never against anything the caller supplied. | The session user has no access to the Build price action menu item in this legal entity: either it lacks the privilege, or no Earmark module is switched on in the legal entity (the menu item is hidden by Earmark's feature toggle). | Assign a role holding Build line prices or Build Earmark purchase prices, or switch the module on in Earmark parameters. |
MGCEarmark_Vrd_PriceConduitBadLineTable | Blocking | %1 is not an order line Earmark builds a price on. Set LineTable to SalesLine or PurchLine. Nothing was built. | LineTable is blank or not one of the two tables. | Send SalesLine or PurchLine. |
MGCEarmark_Vrd_PriceConduitNoLine | Blocking | The request names no order line. Set InventTransId to the lot ID of the sales or purchase order line whose price is to be built. Nothing was built. | InventTransId is blank. | Send the line's lot ID. |
MGCEarmark_Vrd_PriceConduitLineNotFound | Blocking | There is no %1 with lot ID %2 in legal entity %3. Check the lot ID, the line table and the legal entity. Nothing was built. | No line of that table has that lot ID in the legal entity. | Check the lot ID, LineTable and Company. If the line was only just created, make sure its order was saved. |
MGCEarmark_Vrd_PriceAllowanceExceedsLine | Informational | The off-invoice allowance on line %1 is %2, which is more than the line is worth (%3). This is allowed, but check that the allowance and the quantity are both right. | The build was made, but its off-invoice allowance is larger than the line's value. | Nothing required; review the deal and the quantity. |
Refusals the build itself states (step 8). The build orchestrator states each of these as a verdict and
stops, so the button and every other caller hit the same wall; the operation returns them as they were
stated, Blocking, under their own Id. Several can arrive in one answer (for example, one per deal the
composer refuses), and an Informational verdict stated before the refusal is kept.
Id | Message starts with (en-US) | Meaning | What to do |
|---|---|---|---|
MGCEarmark_Vrd_PurchaseBasisIntercompany | Purchase order %1 line %2 is sourced from an intercompany sales order and cannot have purchase Basis built against it. | A purchase line on an intercompany order: its price arrives from the intercompany sales order. | Do not build Earmark prices on intercompany purchase lines. |
MGCEarmark_Vrd_PurchaseBasisAlreadyReceived | Purchase order %1 line %2 has already been received or invoiced and cannot have purchase Basis built against it. | The purchase line is Received or Invoiced. | Price purchase lines before they are received. |
MGCEarmark_Vrd_PriceModuleDisabled | No price was built because the %1 module is switched off in Earmark parameters. | The module for the line (Customer for a sales line, Vendor for a purchase line) is off in this legal entity, while another module is on. | Switch the module on in Earmark parameters. |
MGCEarmark_Vrd_PriceAlreadyBuilt | This line already carries build %1, so a second build was not made. | The line already has a current build, made from the client, by another caller, or under a different key. Stated before the transaction, and again under the lock if another session built the line in between. | Nothing to build. To change the price, a person unbuilds the line in Finance and Operations; then call again with a new key. |
MGCEarmark_Vrd_PriceLineOutsideEditWindow | No price was built for order %1 because the line has moved beyond the point where its terms can still be frozen. | Something under the line's inventory origin has been picked, shipped, received or invoiced. | Price lines before they are released. Deal money for goods already moved is a manual accrual. |
MGCEarmark_Vrd_PriceBaseNegative | The base price %1 is below zero. | BasePrice (or, when not supplied, the line's own unit price) is negative. | Send a base of zero or more; put a discount in OverBasis. |
MGCEarmark_Vrd_PriceModeUnresolved | No price mode can be resolved for deal %1. | No price mode (gross-up or off invoice) can be resolved for an included deal. | Set the default price mode in Earmark parameters, or allow per-deal price modes and set one on the deal. |
MGCEarmark_Vrd_PriceFixedAmountNoQuantity | Deal %1 is a fixed amount per transaction and this line has no quantity to spread it across. | A fixed-per-transaction deal on a line with zero quantity. | Give the line a quantity. |
MGCEarmark_Vrd_DealPurchaseBuildUpGrossUp | Deal %1 is a purchase price build-up deal, which accrues nothing, so its money cannot be grossed up into the purchase price. | A purchase price build-up deal names Gross up (only legacy or imported data can). | Set the deal's price mode to Off invoice. |
MGCEarmark_Vrd_PriceDealNoLongerAvailable | Deal %1 is no longer available and is %2 rather than Approved, so nothing was built. | An included deal left Approved (or disappeared) while the build was being made. Stated under the lock; the whole build is refused. | Call again; the deal is then no longer eligible and is not included. |
Malfunctions (HTTP error, no verdict). The build stops on these without stating a verdict, so the operation throws and the platform answers with an HTTP error carrying the message. Nothing was written.
| Message (internal id) | Meaning | What to do |
|---|---|---|
MGCEarmark_Err_LinePriceDuplicateIdempotencyKey: A price build already exists for idempotency key %1. | The key was already used for a build in this legal entity on another line. | Use a new key for a new build. |
MGCEarmark_Err_ComposerUnitPriceBelowZero: The price for line %1 composes to %2, which is below zero: base %3, over-basis %4, deal money %5. | Base + over-basis + grossed-up deal money is negative. The build refuses the whole equation rather than one deal. | Reduce the over-basis, raise the base, or have a person decline a deal in the price builder. |
MGCEarmark_Err_PriceBuildNoOrigin: No price could be built for line %1 under deal %2 because the line has no inventory transaction origin to anchor a commitment to. | The line has no inventory transaction origin (for example, a non-stocked item). | A configuration or data question for a person. |
| Any other error raised while writing the build | For example, a refusal from accrual instance creation, or from the order line's own validation when its price is written back. | Read the message; usually a person has to act. |
Verdicts that cannot occur on this operation. MGCEarmark_Vrd_PriceAttachNotPermitted,
MGCEarmark_Vrd_PriceDealIneligible, MGCEarmark_Vrd_PriceAmountEditNotAllowed and
MGCEarmark_Vrd_PriceAmountEditCrossesZero answer per-deal decisions, which the wire request cannot carry.
An ineligible deal is simply left out when AcceptAllEligible is true.
Server-side security re-check
The check runs against the session user, before the order line is read, and again when the request reaches
the shared build method (the second answer is the same). It is hasMenuItemAccess on the action menu item
MGCEarmarkPriceBuild, not an attribute on the method. The build orchestrator then makes its own checks in
the layer that writes. Nothing in the request can change who is judged: the service overwrites the audit
actor with the session user on every call.
Idempotency and repeats
buildPrice is idempotent by line and key. The key is matched against the line's own current build, not
looked up across the estate, and it is stored on the build it made.
| Situation | Answer |
|---|---|
| Repeat with the same key, on the same line, while the build that key made is still the line's current build (even if it has since gone Stale) | HTTP 200, Built true, AlreadyBuilt true, the same LinePriceRecId, BuildNumber and amounts, InstanceCount 0, no verdict. Nothing is written. |
| Repeat after the first call was refused (Blocking verdict) | A refusal stores nothing, so the repeat simply tries again and is refused again unless the cause has changed. |
| Repeat after an HTTP error | Safe. If the failure happened before the build committed, nothing was written and the repeat builds (or fails the same way until the cause is fixed); if the build had committed, the repeat answers AlreadyBuilt. |
| A new key (or no key from the client) on a line that is already built | Refused: MGCEarmark_Vrd_PriceAlreadyBuilt. |
| The same key on a different line | HTTP error carrying the A price build already exists for idempotency key message: the key belongs to another build. Use a new key. |
| Rebuilding a line after a person unbuilt it | Use a new key. The new build takes the next BuildNumber; the old build is kept on file. |
| Two calls with the same key at the same moment | One builds. The other is refused with MGCEarmark_Vrd_PriceAlreadyBuilt or answered with an HTTP error, depending on where it met the first; repeat it and it answers AlreadyBuilt. |
Choosing a key. Make it stable for the line and the intent, and unique within the legal entity, for
example <source system>-<order>-<line>-<attempt>. Reuse the key only to repeat the same request.
Examples
All values are illustrative. <environment> is your host name.
Build a sales line with every eligible deal.
POST https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkBuildPriceService/buildPrice
Authorization: Bearer eyJ0eXAiOi...
Content-Type: application/json
{
"_request": {
"Company": "USMF",
"LineTable": "SalesLine",
"InventTransId": "USMF-016293",
"BasePriceSupplied": false,
"BasePrice": 0,
"OverBasisSupplied": false,
"OverBasis": 0,
"AcceptAllEligible": true,
"IdempotencyKey": "erp-SO4711-10-1"
}
}
The line's own unit price is 20.00 per unit. One gross-up deal adds 1.00 and one off-invoice deal carries 0.50:
{
"$id": "1",
"Built": true,
"AlreadyBuilt": false,
"LinePriceRecId": 5637147828,
"BuildNumber": 1,
"UnitPrice": 21.0,
"DealMoney": 1.0,
"Allowance": 0.5,
"InstanceCount": 2,
"Verdicts": []
}
The same call repeated (for example after a timeout) returns the build and writes nothing:
{
"$id": "1",
"Built": true,
"AlreadyBuilt": true,
"LinePriceRecId": 5637147828,
"BuildNumber": 1,
"UnitPrice": 21.0,
"DealMoney": 1.0,
"Allowance": 0.5,
"InstanceCount": 0,
"Verdicts": []
}
Build a purchase line with a supplied base and over-basis, and no deals:
{
"_request": {
"Company": "USMF",
"LineTable": "PurchLine",
"InventTransId": "USMF-016301",
"BasePriceSupplied": true,
"BasePrice": 12.5,
"OverBasisSupplied": true,
"OverBasis": -0.25,
"AcceptAllEligible": false,
"IdempotencyKey": "wms-PO981-3-1"
}
}
An unknown lot ID is a verdict with HTTP 200:
{
"$id": "1",
"Built": false,
"AlreadyBuilt": false,
"LinePriceRecId": 0,
"BuildNumber": 0,
"UnitPrice": 0.0,
"DealMoney": 0.0,
"Allowance": 0.0,
"InstanceCount": 0,
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_PriceConduitLineNotFound",
"Type": "Blocking",
"Message": "There is no SalesLine with lot ID USMF-099999 in legal entity USMF. Check the lot ID, the line table and the legal entity. Nothing was built."
}
]
}
A line already priced in the client, called with a new key:
{
"$id": "1",
"Built": false,
"AlreadyBuilt": false,
"LinePriceRecId": 0,
"BuildNumber": 0,
"UnitPrice": 0.0,
"DealMoney": 0.0,
"Allowance": 0.0,
"InstanceCount": 0,
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_PriceAlreadyBuilt",
"Type": "Blocking",
"Message": "This line already carries build 1, so a second build was not made. A line has exactly one current build at a time, [...] If you are an integration retrying a call, supply the same idempotency key you used the first time and the existing build will be returned to you instead of refused."
}
]
}
curl:
curl -X POST "https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkBuildPriceService/buildPrice" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"_request":{"Company":"USMF","LineTable":"SalesLine","InventTransId":"USMF-016293","AcceptAllEligible":true,"IdempotencyKey":"erp-SO4711-10-1"}}'
2. approveClaim
Service: MGCEarmarkApproveClaimService · Service group: MGCEarmarkServiceGroup · Method:
approveClaimWire
What it does
approveClaim approves one claim that is pending approval, as the session user, through
MGCEarmarkClaimApprovalOrchestrator::approveOutsideWorkflow: the same approval routine that runs when an
approver uses Approve on the claim's workflow work item, followed by canceling the workflow instance the
call overtook (see What happens to the workflow below). On production, once the license has reached its
block date, it stops before either step with MGCEarmark_Vrd_LicenseBlocked and changes nothing. Otherwise it
runs in two steps, each its own transaction.
- The decision. The claim is locked and re-read. Segregation of duties is checked first; then the whole
submit set is re-run, because the claim may have waited in workflow for days. If both pass, the claim
becomes Approved with posting status Posting pending, the session user is stamped as the approver, the
approval (with
Comment) is written to the claim's timeline, and theMGCEarmarkClaimApprovedbusiness event is raised when Publish Earmark claim events is on (Earmark parameters). It is raised at this step, while the claim is still Posting pending, not when the credit posts. - The posting. For each claim line that does not yet have one, an approval movement and its journal
(one journal, one line, one voucher per claim line) are created through the movement engine.
- For a customer claim this is the approval credit in an Earmark journal. It posts by itself when Auto-post claim approval journal (Earmark parameters, Claims tab) is set or Post automatically is on for the Claim approval movement type (Posting control tab); either is enough. Even then it is not posted inside this call: auto-posting runs after the approval commits, from the accrual processor batch job. Otherwise someone posts the journal by hand.
- For a claim whose counterparty is a vendor (supplier rebates, third-party payables, mirror twins) the approval is an AP proposal in a vendor invoice journal, which accounts payable reviews and posts. It is never posted automatically.
The claim header reads Posted, and the answer's Credited reads true, only when every line's approval
credit has really posted. Right after an approval Credited is therefore usually false. Repeat the call
(it is a safe repeat, see below) or read the claim's PostingStatus through the MGCEarmarkClaims entity to
follow it.
Before calling. The claim must have been submitted to the claim approval workflow, which records the
workflow instance on the claim. Get its id from the claim's WorkflowInstanceId field (readable through the
MGCEarmarkClaims data entity, which the Earmark claims approver role can read) or from the workflow work
item's correlation id.
What happens to the workflow. The call decides outside the workflow: it does not complete the work item. When the call moves the claim (approves it, or returns it to Open at re-validation), Earmark then cancels the workflow instance the claim was running under, so the work item leaves its assignee's list and workflow history records why ("Claim ... was approved by ... outside this workflow, so the workflow was canceled."). A segregation-of-duties denial leaves the claim Pending approval and the workflow untouched, for another approver. If the cancel fails, the decision stands and a Workflow callback write row on the execution exceptions workbench cancels it on Retry selected (the Accounting manager, the Accounts receivable manager and the Accounts payable manager hold Retry; run it while you are in the claim's legal entity, because a retry runs in the company you are in). (Changed after build 1.0.47.2; in that build the work item stayed open over the decided claim. The cancel against a live workflow instance is read from the code and not verified by a live call.) An approved claim is final: to undo it, reverse it in the client.
Request
Contract: MGCEarmarkApproveClaimWireRequest, sent as _request.
| Member | JSON type | Required | When omitted | Rules |
|---|---|---|---|---|
Company | string | No | Session company | Legal entity id. See Company context. |
ClaimId | string | Yes | "": refused (ClaimConduitNoClaim) | The claim id in the legal entity (at most 60 characters; a longer id is answered as not found). |
WorkflowInstanceId | string | Yes | "": refused (ClaimConduitNoKey) | The GUID of the workflow instance the claim is running under, as text in the 8-4-4-4-12 form, with or without braces, in any letter case. Surrounding spaces are ignored. Anything else is refused (ClaimConduitBadInstanceId). |
Comment | string | No | "" | The approver's comment. It is written to the claim's timeline with the approval. |
There is no approver member: the approver is always the session user.
Response
Contract: MGCEarmarkApproveClaimWireResult
| Member | JSON type | Meaning |
|---|---|---|
Approved | boolean | true when the claim is Approved after this call, including on a repeat. |
AlreadyApproved | boolean | true when the claim was already approved before this call. Nothing was posted by this call. |
Credited | boolean | true when the claim's posting status is Posted: every line's approval credit has posted. false on an approved claim is normal (posting pending, or an AP proposal not yet posted). |
ClaimId | string | The ClaimId the call sent. |
WorkflowInstanceId | string | The instance id the call sent, as a GUID in upper case without braces. Blank when none was sent, when it was not a GUID, or when the legal entity was refused. |
Verdicts | array of verdict | See The verdict object. |
Order of checks
Companyresolves to a legal entity, orMGCEarmark_Vrd_ConduitCompanyNotFound.WorkflowInstanceId, when sent, is a GUID, orMGCEarmark_Vrd_ClaimConduitBadInstanceId.ClaimIdis no longer than 60 characters, orMGCEarmark_Vrd_ClaimNotFound.ClaimIdis not blank, orMGCEarmark_Vrd_ClaimConduitNoClaim.WorkflowInstanceIdis not blank, orMGCEarmark_Vrd_ClaimConduitNoKey.- The claim exists in the legal entity, or
MGCEarmark_Vrd_ClaimNotFound. - The claim is running under the instance the call names, or
MGCEarmark_Vrd_ClaimConduitInstanceMismatch. - The claim is not already approved; if it is, the call is answered
AlreadyApprovedwith the InformationalMGCEarmark_Vrd_ClaimConduitAlreadyApproved. - When the claim is Pending approval: the license has not reached its block date on production, or
MGCEarmark_Vrd_LicenseBlocked(nothing changes). - The decision (under the claim lock): the claim is still not approved and is Pending approval; segregation of duties; the full re-validation, which ends by asking the accrual engine whether it would accept each line's approval credit.
- When the decision approved the claim or returned it to Open: the workflow instance is canceled.
- The posting.
Verdicts
Id | Type | Message (en-US; %n is filled in) | Meaning | Claim afterwards | What the caller should do |
|---|---|---|---|---|---|
MGCEarmark_Vrd_ConduitCompanyNotFound | Blocking | Legal entity %1 does not exist. [...] Nothing was done. | Company names no legal entity. | Unchanged | Correct Company. |
MGCEarmark_Vrd_ClaimConduitBadInstanceId | Blocking | %1 is not a workflow instance identifier. Supply the GUID of the workflow instance the claim is running under, as the work item carries it. Nothing was approved. | WorkflowInstanceId is not a GUID. | Unchanged | Send the GUID. |
MGCEarmark_Vrd_ClaimConduitNoClaim | Blocking | The request names no claim. | ClaimId is blank. | - | Send the claim id. |
MGCEarmark_Vrd_ClaimConduitNoKey | Blocking | The request carries no workflow instance identifier. approveClaim is idempotent by claim identifier and workflow instance identifier, and a call that cannot be identified cannot be safely repeated. | WorkflowInstanceId is blank. | Unchanged | Send the instance id. |
MGCEarmark_Vrd_ClaimNotFound | Blocking | Claim %1 does not exist. | No claim with that id in the legal entity. | - | Check ClaimId and Company. |
MGCEarmark_Vrd_ClaimConduitInstanceMismatch | Blocking | Claim %1 is running under workflow instance %2, not %3. | The claim is under a different workflow instance (for example, it was recalled or returned and submitted again), or it was never submitted and has no instance. | Unchanged | Read the claim's current WorkflowInstanceId and decide again: it is a different approval decision. |
MGCEarmark_Vrd_ClaimConduitAlreadyApproved | Informational | Claim %1 was already approved under workflow instance %2; nothing was posted by this call. | A repeat of a call that already approved the claim (or the claim was approved another way under that instance). Approved and AlreadyApproved are true; Credited is current. | Unchanged | Nothing; treat as success. |
MGCEarmark_Vrd_LicenseBlocked | Blocking | Earmark's license has reached its block date on this production environment. New deals and claims cannot be created (the deal and claim migration loads are not refused), and deals, amendments and claims cannot be approved. Existing deals keep pricing and accruing, and approved claims keep settling. Renew the license, or contact Magicite. | Production only: Earmark's license has reached its block date, and the claim is Pending approval. | Unchanged: still Pending approval, workflow untouched | Have the license renewed, then repeat the same call. |
MGCEarmark_Vrd_ClaimAlreadyApproved | Blocking | Claim %1 was already approved by %2. | The claim was approved by someone else between this call's first read and its lock (a race). | Approved by the other caller | Nothing; repeat the call to read the outcome. |
MGCEarmark_Vrd_ClaimNotPendingApproval | Blocking | Claim %1 is %2, and only a claim pending approval can be approved. | The claim is Open (recalled, rejected, or returned at an earlier approval; it keeps the instance id it ran under) or Reversed. | Unchanged | A person fixes and resubmits the claim; that starts a new workflow instance with a new id. |
MGCEarmark_Vrd_SoDClaimDenied | Blocking | One of the segregation-of-duties sentences below. | The session user may not approve this claim. | Stays Pending approval; the denial is written to the claim's timeline | Another user must approve it. Do not retry with the same identity. |
MGCEarmark_Vrd_ClaimPeriodClosed | Blocking | The ledger period containing %1 is not open, so claim %2 cannot be approved into it. | Re-validation: today's date (in the user's time zone) is not in an open ledger period. | Returned to Open, reason on the timeline | Open the period, then resubmit the claim. |
MGCEarmark_Vrd_ClaimLineNotClaimed | Blocking | Claim line %1 is no longer in the claimed state; its accrual transaction is %2. | Re-validation: a line's accrual was reversed or adjusted under the claim. | Returned to Open | Correct the claim, then resubmit. |
MGCEarmark_Vrd_ClaimJournalNotPosted | Blocking | The claim journal for claim line %1 has not been posted, so the approval credit cannot be raised against it. | Re-validation: a line's claim journal is not posted. | Returned to Open | Post the claim journal, then resubmit. |
MGCEarmark_Vrd_ClaimApprovalAccountUnresolved | Blocking | No claim approval account can be resolved for claim line %1: %2 | Re-validation: no claim-approval posting setup covers a line (%2 is the line's deal). | Returned to Open | Complete the posting setup, then resubmit. |
MGCEarmark_Vrd_ClaimReturnFlagBlocked | Blocking | Claim line %1 carries an unresolved return-after-claim flag. Accept or clear the flag before the claim is approved. | Re-validation: a return arrived after the line was claimed, and the parameter Block claim approval of return-flagged lines is on (the shipped default). | Returned to Open | Accept or clear the flag, then resubmit. |
MGCEarmark_Vrd_ClaimNoLines | Blocking | Claim %1 has no lines, so there is nothing to approve. | Re-validation: the claim has no lines. | Returned to Open | Correct the claim. |
MGCEarmark_Vrd_ClaimLineCreditUnavailable | Blocking | Claim line %1 cannot be credited: %2 Until that is resolved the claim can be neither submitted nor approved, and nothing is credited. [...] | Re-validation: the accrual engine would refuse the line's approval credit (%2 is the engine's own sentence), for example because the line's module was switched off after the claim was submitted, or its accrual instance was withdrawn. Nothing is approved. | Returned to Open | Fix the cause (switch the module back on), or correct the claim, then resubmit. |
MGCEarmark_Vrd_ClaimLineCreditRefused | Informational | Claim line %1 was approved, but its credit could not be raised: %2 The claim stays Posting pending, and a Post claim approval journal row [...] | The claim was approved, and between the decision and the posting the engine refused one line's credit (the cause changed in that instant). | Approved, Posting pending | Fix the cause, then Retry selected on the workbench row. |
MGCEarmark_Vrd_ClaimReturnFlagWarning | Informational | Claim line %1 carries an unresolved return-after-claim flag. | The same flag with Block claim approval of return-flagged lines off. Does not stop the approval. | As the rest of the call decides | Review the return. |
MGCEarmark_Vrd_SoDClaimDealApproverWarning | Informational | %1 approved the deal behind claim %2. | The session user approved a deal behind the claim, and Block claim approval by the deal's approver is off. Does not stop the approval. | Approved | Nothing required. |
MGCEarmark_Claim_ApprovedSummary | Informational | Claim %1 approved by %2; %3 line(s) credited. | The approval succeeded. %3 counts the lines that received an approval movement (their credit journal exists, posted or not). | Approved, Posting pending until the credits post | Read Approved and Credited. |
Re-validation verdicts name every failing line, so one answer can carry several of them.
The segregation-of-duties sentences carried in Message under MGCEarmark_Vrd_SoDClaimDenied:
| Rule (internal id) | Message (en-US) |
|---|---|
The approver generated or submitted the claim (MGCEarmark_Vrd_SoDSelfApproval) | %1 cannot approve %2 %3 because they raised it. Approval is a second pair of eyes on a commitment, so the person who authored or submitted a document is never the person who signs it off. [...] Route the approval to another holder of the approver duty. |
The approver does not hold the duty (MGCEarmark_Vrd_SoDClaimDutyNotHeld) | %1 does not hold the Approve Earmark claims duty, so they cannot approve claim %2. |
The duty is not published in the environment (MGCEarmark_Vrd_SoDClaimDutyNotPublished) | The Approve Earmark claims duty (%1) is not published in this environment, so nobody can be shown to hold it and claim %2 cannot be approved. |
The approver approved a deal behind the claim, and Block claim approval by the deal's approver is on (the shipped default) (MGCEarmark_Vrd_SoDClaimDealApproverConflict) | %1 approved the deal behind claim %2 and may not also approve the claim. |
No generator or submitter is recorded on the claim (MGCEarmark_Vrd_SoDDocumentTypeUnregistered) | Approval of %1 %2 is refused because no segregation-of-duties rule is registered for this document type, so the product cannot establish who raised it. [...] |
Role and segregation-of-duties re-check
The role question and the segregation question are answered by one function,
MGCEarmarkSoDVerdict::approvalVerdict (extended for claims by MGCEarmarkClaimsSoD_Extension), against the
session user, on every call, whatever segregation rules the customer has set up. In order:
- Raised it. The user is not the claim's generator (
GeneratedBy) or submitter (SubmittedBy). - Holds the duty. One of the user's assigned roles holds
MGCEarmarkApproveClaimsDuty. - Approved a deal behind it. If the user approved any deal one of the claim's lines draws on, the approval is refused when Block claim approval by the deal's approver is on (the default), or goes ahead with an Informational warning when it is off.
A denial leaves the claim Pending approval for another approver, and nothing is posted. The duty is checked by name rather than through a menu item, because two of the approval's routes (this operation and the workflow work item) have no menu item in their path.
Idempotency and repeats
approveClaim is idempotent by claim id and workflow instance id.
| Situation | Answer |
|---|---|
Repeat of a call that approved the claim (same ClaimId and WorkflowInstanceId) | HTTP 200, Approved true, AlreadyApproved true, Credited as it is now, Informational MGCEarmark_Vrd_ClaimConduitAlreadyApproved. Nothing is posted. A safe way to poll Credited. |
| Repeat after a segregation-of-duties denial | Refused the same way, unless the user's roles changed. The claim is still Pending approval. |
| Repeat after a license block refusal | Refused the same way until the license is restored; then the same call approves the claim. The claim is still Pending approval. |
| Repeat after a re-validation failure | MGCEarmark_Vrd_ClaimNotPendingApproval: the claim is Open. After a person fixes and resubmits it, the claim runs under a new instance, and the old instance id gets MGCEarmark_Vrd_ClaimConduitInstanceMismatch. |
| Repeat after an HTTP error from the posting step | The decision had committed: the claim is Approved / Posting pending. The repeat answers AlreadyApproved with Credited false and posts nothing. The credit is completed from the execution exceptions workbench (see below), never by repeating the call. |
| The claim was approved in the client under the same instance | Answered as a repeat (AlreadyApproved). |
| Two calls at the same moment | The decision re-reads the claim under its lock, so only one approves. The other gets AlreadyApproved, or MGCEarmark_Vrd_ClaimAlreadyApproved if it was already past the first check. |
The posting step cannot credit a line twice: a line that already has an approval movement is skipped, and the movement engine refuses a second one.
Failures (HTTP errors)
| Failure | What happened | State afterwards | What to do |
|---|---|---|---|
| The approval journal could not be created or posted for an environmental reason | HTTP error. The message is The claim approval journal for claim %1 could not be posted. (MGCEarmark_Err_ClaimApprovalPostFailed). | The claim is Approved / Posting pending: the decision had already committed, and the whole posting step rolled back. A row with operation Post claim approval journal is raised on the Earmark execution exceptions workbench. Nothing is posted to a suspense account. | Fix the cause named on the workbench row (often posting setup), then use Retry selected on that row (Earmark > Inquiries and reports > Earmark execution exceptions; Accounting manager, Accounts receivable manager or Accounts payable manager), while you are in the claim's legal entity. Retry cannot double-credit. Repeating approveClaim only answers AlreadyApproved. |
| Any other exception in the decision step | HTTP error. | Unchanged: the decision is one transaction. | Resend the same body once the cause is fixed. |
A line the accrual engine would refuse refuses the approval. The re-validation asks the engine whether it
would accept each line's approval credit before anything is approved, so a line whose module was switched off,
or whose accrual instance was withdrawn, returns the claim to Open with
MGCEarmark_Vrd_ClaimLineCreditUnavailable and approves nothing. Only if the cause changes in the instant
between the decision and the posting is a line still refused there: the claim is then approved, the answer
carries MGCEarmark_Vrd_ClaimLineCreditRefused for that line, Credited stays false, and a Post claim
approval journal row is raised so Retry selected credits it once the cause is fixed. (Changed after
build 1.0.47.2; in that build such a line was left uncredited with no verdict and no workbench row.)
Examples
All values are illustrative.
Approve a customer claim.
POST https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkApproveClaimService/approveClaim
Authorization: Bearer eyJ0eXAiOi...
Content-Type: application/json
{
"_request": {
"Company": "USMF",
"ClaimId": "USMF-00123",
"WorkflowInstanceId": "6f1e2d3c-4b5a-4978-8a69-5b4c3d2e1f00",
"Comment": "Approved in the trade promotion tool"
}
}
{
"$id": "1",
"Approved": true,
"AlreadyApproved": false,
"Credited": false,
"ClaimId": "USMF-00123",
"WorkflowInstanceId": "6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00",
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Claim_ApprovedSummary",
"Type": "Informational",
"Message": "Claim USMF-00123 approved by earmarkappr; 2 line(s) credited."
}
]
}
The same call later, after the accrual processor batch posted the approval journal:
{
"$id": "1",
"Approved": true,
"AlreadyApproved": true,
"Credited": true,
"ClaimId": "USMF-00123",
"WorkflowInstanceId": "6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00",
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_ClaimConduitAlreadyApproved",
"Type": "Informational",
"Message": "Claim USMF-00123 was already approved under workflow instance {6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00}; nothing was posted by this call."
}
]
}
Denied by segregation of duties (the service user does not hold the duty):
{
"$id": "1",
"Approved": false,
"AlreadyApproved": false,
"Credited": false,
"ClaimId": "USMF-00123",
"WorkflowInstanceId": "6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00",
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_SoDClaimDenied",
"Type": "Blocking",
"Message": "earmarkappr does not hold the Approve Earmark claims duty, so they cannot approve claim USMF-00123."
}
]
}
Returned to Open at re-validation (the period is closed):
{
"$id": "1",
"Approved": false,
"AlreadyApproved": false,
"Credited": false,
"ClaimId": "USMF-00123",
"WorkflowInstanceId": "6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00",
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_ClaimPeriodClosed",
"Type": "Blocking",
"Message": "The ledger period containing 10/28/2026 is not open, so claim USMF-00123 cannot be approved into it."
}
]
}
An unknown claim:
{
"$id": "1",
"Approved": false,
"AlreadyApproved": false,
"Credited": false,
"ClaimId": "USMF-99999",
"WorkflowInstanceId": "6F1E2D3C-4B5A-4978-8A69-5B4C3D2E1F00",
"Verdicts": [
{
"$id": "2",
"Id": "MGCEarmark_Vrd_ClaimNotFound",
"Type": "Blocking",
"Message": "Claim USMF-99999 does not exist."
}
]
}
curl:
curl -X POST "https://<environment>/api/services/MGCEarmarkServiceGroup/MGCEarmarkApproveClaimService/approveClaim" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"_request":{"Company":"USMF","ClaimId":"USMF-00123","WorkflowInstanceId":"6f1e2d3c-4b5a-4978-8a69-5b4c3d2e1f00","Comment":"Approved in the trade promotion tool"}}'
Rate limiting and throttling
Finance and Operations applies its standard service protection limits to these calls. A throttled call gets
HTTP 429, usually with a Retry-After header, and did not run. Wait at least that long and resend the same
body; both operations are safe to resend. Earmark adds no limits of its own.
Contract stability
- The request and result member names (
Company,LineTable,InventTransId,BasePriceSupplied,BasePrice,OverBasisSupplied,OverBasis,AcceptAllEligible,IdempotencyKey,Built,AlreadyBuilt,LinePriceRecId,BuildNumber,UnitPrice,DealMoney,Allowance,InstanceCount,ClaimId,WorkflowInstanceId,Comment,Approved,AlreadyApproved,Credited,Verdicts,Id,Type,Message) are a published contract. Earmark's build pins them with tests that serialize and deserialize through the platform's JSON serializer. - A verdict
Idis stable. ItsMessagewording can change between releases and always follows the service user's language. - Tolerate members you do not model (such as
$id).
Related documents
- User guide: Pricing and accruals (Build a price from another system) and Claims, statements and settlement (Approve a claim from another system, claim approval outcomes, the execution exceptions workbench).
- Integration developer: the role guide for whoever builds the integration (JSON services, data entities, business events), including what the license block refuses for an integration.
- Operations: approval workflows, background steps and retry (the execution exceptions workbench), business events, inbound order line pricing, journal auto-post and license check.
- Configuration reference: the Earmark parameters these operations read (Claims and Posting control tabs, the event switches).
- Security reference: roles, duties and privileges.
- Data entity reference: data entities, including
MGCEarmarkClaims(claim status, posting status, workflow instance id). - Installation guide: installing Earmark.
- How Earmark changes your processes and Forms guide.
How this reference was verified
Every statement was read from the Earmark model on 2026-10-29, and the licensing, role and approval-routine
statements were read again on 2026-11-06; nothing was called against a running environment while writing it. buildPrice's verdict and malfunction split and approveClaim's workflow cancel
and credit re-validation are proved by Earmark's X++ tests, not by a live call.
Statements marked (not verified) describe platform behavior that the code does not settle.