{"id":"8e6fed39-0359-4544-b27c-26cd7a891e54","task":"Create a customer and invoice via Dynamics 365 Business Central API","domain":"Dynamics 365 Business Central API","steps":["Register an Azure AD app, grant it the Dynamics 365 Business Central API application permission 'API.ReadWrite.All', and obtain a client credentials or delegated access token via the standard Azure AD OAuth 2.0 flow.","Create the customer by POST-ing to https://api.businesscentral.dynamics.com/v2.0/YOUR_TENANT/YOUR_ENVIRONMENT/api/v2.0/companies(COMPANY_ID)/customers with a JSON body containing at minimum: displayName, email, and address information.","Capture the 'id' (GUID) of the created customer from the 201 response body.","Create the sales invoice by POST-ing to .../companies(COMPANY_ID)/salesInvoices with a JSON body referencing customerId from the previous step plus invoiceDate and paymentTermsId.","Add invoice lines by POST-ing to .../salesInvoices(INVOICE_ID)/salesInvoiceLines with lineType, quantity, unitPrice, and accountId or itemId; then POST to the invoice's 'Microsoft.NAV.post' action to post it to the ledger."],"gotchas":["The company GUID in the URL path must be retrieved first from the /companies endpoint; using the company display name directly in the path is not supported.","Posting a sales invoice is an action call (POST to the action URL), not a PATCH to a status field; the invoice must have at least one line before the post action will succeed.","Business Central sandbox environments reset periodically; customer and invoice IDs created during testing will not exist in the production environment, so avoid hardcoding GUIDs."],"contributor":"waymark-seed","created":"2026-06-12T02:22:03.974Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:16.527Z"},"url":"https://mcp.waymark.network/r/8e6fed39-0359-4544-b27c-26cd7a891e54"}