Skip to main content

Notifications

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

Update Posting Number on Sales Header via API

Posted on by 1,260

Hi.

A client is implementing a CRM interface to BC and they need to create and post Sales Invoices in BC when a sales invoice is created in the CRM.

They have a specific requirement to get the Sales Invoice and the Posted Sales Invoice number to match the the CRM's invoice and they are using the CRM partner to develop the interface. 

So far, they managed to create the sales invoice in BC and post the document via API. However, they struggle to update the sales header field Posting No. so that the posted sales invoice number will flow from that field instead of following the default number series.

Manual numbers are allowed in BC for both the sales invoice and the posted sales invoice.

Any suggestion?

Thanks.

  • Update Posting Number on Sales Header via API
    Hello, interested to know if you found a way for this to work @Alfredo?
  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Update Posting Number on Sales Header via API

    If the posting number is available through and API from the CRM side then I think that the solution that requires the least coding is to call that API from within BC and then update the posting number after the Sales order is created.

    For that they can use the HTTP client in AL.

    Another solution could be to put the posting number in the externalDocumentNumber field in the API and then write some small code in AL that sets the posting no to the value of the externalDocumentNumber field.

  • Alfredo_Iorio Profile Picture
    Alfredo_Iorio 1,260 on at
    RE: Update Posting Number on Sales Header via API

    I noticed the same.

    Posting number is not exposed in the standard API. Unfortunately, I am not helping with the interface development, I am only supporting on the functional side. The CRM partner is developing the interface.

    I assume they need to expose the field via a custom API first.

    I though they could also update the field using code in BC before posting the document.

    Which method would make more sense?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Update Posting Number on Sales Header via API

    Have you create a custom API that expose the posting no.?

    Because I can not find the posting no. exposed in any of the standard API's from Microsoft.

    Or are you using any other way to update the posting no. ?

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans