Skip to main content
Post a question

Notifications

Announcements

No record found.

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

Update Posting Number on Sales Header via API

Posted on 28 May 2023 14:42:21 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.

  • Community member Profile Picture
    Community member 4 on 25 Sep 2023 at 00:42:33
    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 28 May 2023 at 15:21:35
    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 28 May 2023 at 15:04:56
    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 28 May 2023 at 14:56:19
    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans