Skip to main content

Notifications

Small and medium business | Business Central, N...
Unanswered

Sales Invoice remainingAmount not updated

Posted on by 20

Hi,
I hope you can help me. We are using the sales invoice API to create an invoice & customer payment API to create an invoice payment.
When we use the pull sales invoice using API, the payload's /remainingAmount/ field is not being updated correctly. 

Posting below the response received from the API

Invoice Payment (partial) as Posted to MS Business Central

{    /customerId/ : /78ec536c-2756-ec11-bb7d-000d3aaa1396/,    /postingDate/ : /2023-04-03/,    /amount/ : 1000.0,    /appliesToInvoiceId/ : /301e3f21-d0a8-ed11-9a8a-000d3a9e93b2/,    /description/ : /Invoice Payment: auxiliary/,    /comment/ : /Invoice Payment: auxiliary/,    /documentNumber/ : /C389217/,    /customerPaymentJournal/ : {        /code/ : /PMT-566828/,        /balancingAccountId/ : /53ec536c-2756-ec11-bb7d-000d3aaa1396/,        /displayName/ : /Custom Cash Receipt Journal/    }}


Invoice Payment as Pulled from MS Business Central

{      /@odata.etag/: /W////JzIwOzE2MzIwMjYyMTk2NzAyNTg0MDIxMTswMDsn////,      /id/: /0dd97ae4-5ed2-ed11-a7c7-0022482c9333/,      /code/: /PMT-566828/,      /displayName/: /Custom Cash Receipt Journal/,      /lastModifiedDateTime/: /2023-04-03T20:34:13.35Z/,      /balancingAccountId/: /53ec536c-2756-ec11-bb7d-000d3aaa1396/,      /balancingAccountNumber/: /40100/,      /customerPayments/: [        {          /@odata.etag/: /W////JzIwOzE0MTQ2NTQxMzU5NjQ0MTEzNzA3MTswMDsn////,          /id/: /0ed97ae4-5ed2-ed11-a7c7-0022482c9333/,          /journalId/: /0dd97ae4-5ed2-ed11-a7c7-0022482c9333/,          /journalDisplayName/: /PMT-566828/,          /lineNumber/: 10000,          /customerId/: /78ec536c-2756-ec11-bb7d-000d3aaa1396/,          /customerNumber/: /20000/,          /postingDate/: /2023-04-03/,          /documentNumber/: /C389217/,          /externalDocumentNumber/: //,          /amount/: 1000,          /appliesToInvoiceId/: /301e3f21-d0a8-ed11-9a8a-000d3a9e93b2/,          /appliesToInvoiceNumber/: /PS-INV103347/,          /description/: /Invoice Payment: auxiliary/,          /comment/: /Invoice Payment: auxiliary/,          /lastModifiedDateTime/: /2023-04-03T20:34:15.757Z/        }      ]    },

 

Invoice as Pulled from MS Business Central (after the partial payment)

{      /@odata.etag/: /W////JzE5OzY3Nzg0NTcyMDM4MDkxMDg3MDgxOzAwOyc=////,      /id/: /301e3f21-d0a8-ed11-9a8a-000d3a9e93b2/,      /number/: /PS-INV103347/,      /externalDocumentNumber/: //,      /invoiceDate/: /2023-02-09/,      /postingDate/: /2023-02-09/,      /dueDate/: /2024-02-09/,      /customerPurchaseOrderReference/: //,      /customerId/: /78ec536c-2756-ec11-bb7d-000d3aaa1396/,      /customerNumber/: /20000/,      /customerName/: /Trey Research/,      /billToName/: /Trey Research/,      /billToCustomerId/: /78ec536c-2756-ec11-bb7d-000d3aaa1396/,      /billToCustomerNumber/: /20000/,      /shipToName/: /Trey Research/,      /shipToContact/: /Helen Ray/,      /sellToAddressLine1/: /153 Thomas Drive/,      /sellToAddressLine2/: //,      /sellToCity/: /Chicago/,      /sellToCountry/: /US/,      /sellToState/: /IL/,      /sellToPostCode/: /61236/,      /billToAddressLine1/: /153 Thomas Drive/,      /billToAddressLine2/: //,      /billToCity/: /Chicago/,      /billToCountry/: /US/,      /billToState/: /IL/,      /billToPostCode/: /61236/,      /shipToAddressLine1/: /153 Thomas Drive/,      /shipToAddressLine2/: //,      /shipToCity/: /Chicago/,      /shipToCountry/: /US/,      /shipToState/: /IL/,      /shipToPostCode/: /61236/,      /currencyId/: /00000000-0000-0000-0000-000000000000/,      /shortcutDimension1Code/: /SALES/,      /shortcutDimension2Code/: /MEDIUM/,      /currencyCode/: /USD/,      /orderId/: /00000000-0000-0000-0000-000000000000/,      /orderNumber/: //,      /paymentTermsId/: /84eb536c-2756-ec11-bb7d-000d3aaa1396/,      /shipmentMethodId/: /00000000-0000-0000-0000-000000000000/,      /salesperson/: /JO/,      /pricesIncludeTax/: false,      /remainingAmount/: 5000,      /discountAmount/: 0,      /discountAppliedBeforeTax/: true,      /totalAmountExcludingTax/: 5000,      /totalTaxAmount/: 0,      /totalAmountIncludingTax/: 5000,      /status/: /Open/,      /lastModifiedDateTime/: /2023-02-09T23:19:03.077Z/,      /phoneNumber/: //,      /email/: /helen.ray@contoso.com/,      /currency/: null,      /paymentTerm/: {        /@odata.etag/: /W////JzE5OzQ5NDU4ODM0NTg2MTU4OTk5NDgxOzAwOyc=////,        /id/: /84eb536c-2756-ec11-bb7d-000d3aaa1396/,        /code/: /14 DAYS/,        /displayName/: /Net 14 days/,        /dueDateCalculation/: /14D/,        /discountDateCalculation/: //,        /discountPercent/: 0,        /calculateDiscountOnCreditMemos/: false,        /lastModifiedDateTime/: /2021-12-06T00:00:17.883Z/      },      /salesInvoiceLines/: [        {          /@odata.etag/: /W////JzIwOzE4MjMwMjY4NzMyMzAxMzk2NTI4MTswMDsn////,          /id/: /321e3f21-d0a8-ed11-9a8a-000d3a9e93b2/,          /documentId/: /301e3f21-d0a8-ed11-9a8a-000d3a9e93b2/,          /sequence/: 10000,          /itemId/: /00000000-0000-0000-0000-000000000000/,          /accountId/: /53ec536c-2756-ec11-bb7d-000d3aaa1396/,          /lineType/: /Account/,          /lineObjectNumber/: /40100/,          /description/: /Push Invoice: auxiliary/,          /unitOfMeasureId/: /00000000-0000-0000-0000-000000000000/,          /unitOfMeasureCode/: //,          /unitPrice/: 500,          /quantity/: 10,          /discountAmount/: 0,          /discountPercent/: 0,          /discountAppliedBeforeTax/: false,          /amountExcludingTax/: 5000,          /taxCode/: /NONTAXABLE/,          /taxPercent/: 0,          /totalTaxAmount/: 0,          /amountIncludingTax/: 5000,          /invoiceDiscountAllocation/: 0,          /netAmount/: 5000,          /netTaxAmount/: 0,          /netAmountIncludingTax/: 5000,          /shipmentDate/: /2023-02-09/,          /itemVariantId/: /00000000-0000-0000-0000-000000000000/,          /locationId/: /22ec536c-2756-ec11-bb7d-000d3aaa1396/        }      ]    },
 
Actual Result: /remainingAmount/: 5000
Expected Result: /remainingAmount/: 4000

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans