web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Order's Line Item didn't Shipped

(0) ShareShare
ReportReport
Posted on by 40


Hi

I used the API https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorderline_update  to fulfill a line item of an order,
updated shipQuantity, and invoiceQuantity, and got an Ok response, but I see the ShippedQuantity is still empty. what is the reason for that, do I have to make another API Call for this?

I also noticed this ShippedQuantity is a read-only field, we can't set this value


Thanks in advance!


pastedimage1640788379284v1.png

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    The field you should update is the field Qty to ship. The field Quantity shipped is updated when you post your shipment in Business Central.

    So you need to update the Qty. to ship on the lines and then use the sales order api to post the shipment.

  • Khungersumit Profile Picture
    40 on at

    Hi Inge M. Bruvik
    Thanks for replying

    I tried with only passing quantity as you suggested but still, the shippedQuantity remains the same. (Also I am updating an Open order's line item but that shouldn't be an issue I guess)

    I have also tried passing shipQuantity, and invoiceQuantity but still shippedQuantity remain the same (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorderline_update)

    Please have a look at the attached screenshot.

    3288.Screenshot_5F00_1.png


  • Suggested answer
    JAngle Profile Picture
    133 on at

    What are the location settings? If using warehousing it throws a message in the UI about bypassing it.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    I see that. But i can not see that you do any posting in your code?

    The salesOrder resource type offers a bound action called shipAndInvoice which ship and invoices the corresponding salesOrder batch. This is illustrated in the following example: SHIPANDINVOICE https://<server address>:<server API port>/<server instance name>/api/v2.0/companies({id})/salesOrders({id})/Microsoft.NAV.shipAndInvoice

    The response has no content; the response code is 204.

  • Khungersumit Profile Picture
    40 on at

    Hi Inge M. Bruvik
    Thanks for replying

    Sorry I didn't get your point.

    I want to create a shipment of orders for the following cases
    Can you please assist the appropriate APIs for the following cases? 

    1). Partial Fulfillment Case: Order's line-item individually but I also want the item ShippedQuantity should change since I fulfill the line item which is the issue I have explained above.

    2). Full Order Fulfillment: I want to fulfill or create shipment of an entire order means all line items at once.

    3) Which API should I use to set Tracking Information for an order while creating a shipment?

    Thanks in advance 

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    I will try to be be a bit clearer then.

    The process of creating a shipment in Business Central is a two step process..

    First you have to set the qty. you want to ship on the Sales order lines you want to ship. For that purpose you use the field "Qty. to ship".

    In order to do perform the actual shipment you have to do an action called "Post" that process will draw the items from your inventory, create a posted shipment document in Business Central and it will update the Qty. shipped field on your sales lines. You can not update the Qty. shipped field on your sales lines directly. That update is a system process that is done as a result of you posting the shipment.

    And for doing the "post" action you have to use the bound action SHIPANDINVOICE that i mentioned in the previous post.

    So in your scenarios the steps you have to go through is:

    1) Partial

    • Update all the lines you want to ship with the qty. to ship
    • If you want to invoice you also need to update the qty. to invoice. If you don't want to invoice. Qty. to invoice should be set to zero
    • Run the bound action SHIPANINVOICE on the sales order

    2) full order

    • Update all the lines you want to ship with the qty. to ship. In this case it will be all the lines on your salesorder
    • If you want to invoice you also need to update the qty. to invoice. If you don't want to invoice. Qty. to invoice should be set to zero
    • Run the bound action SHIPANINVOICE on the sales order

    3)  Tracking information

    So it is important to understand that you can not update the shipped qty directly on the sales line. You need to do the post action to actually fulfill your shipment in Business Central.

    Did that make it any clearer?

    I am sorry i did not find any good complete examples to share with you that shows you the steps in code.

  • Khungersumit Profile Picture
    40 on at

    Hi Inge M. Bruvik
    Thanks for the detailed explanation. Really appreciate your time 
     
    Can you please check these :)
    For the 3rd query: You suggested the following but I couldn't find any such "Package Tracking No" field or similar on the APIs (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorder_update)
    , Can you please share the API reference for this "Package Tracking No" field?

    • You can update the field "Package Tracking No" on the sales order before you run the bounded SHIPANDINVOICE. Then you can use the sales order API.


    from 1st query, you have suggested a couple of times already sorry I didn't get this. We have these 2 fields for Quantity, can you please tell which is qty. to ship field you were referencing is it quantity (If I am not wrong this is the ordered Quantity we shouldn't set this?) or shipQuantity? (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorderline_update)

                       
    Update all the lines you want to ship with the qty. to ship

    pastedimage1640933932920v1.png











  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Hi again,

    I understand your confusion because i was using the field names that you see in the Business Central GUI and not the field names that is used in the api.

    So the quantity field in the API is the ordered quantity - like the quantity the customer ordered.

    "invoiceQuantity": "decimal",
    "shipQuantity": "decimal",

    These are the fields that you will use to set the quantity you want to ship and the quantity you want to invoice in this posting. So you set those fields and then you do the posting.

    "shippedQuantity": "decimal",
    "invoicedQuantity": "decimal",

    Are updated after posting and will show the total quantity shipped and total quantity invoiced. And the numbers you find in these two fields can be the result of one or more postings.

    When it comes to the shipment tracking it looks like Microsoft did not include that in any of their standard API's.

    So for this we should implement a custom API. And for that we need to develop a custom API page.
    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-develop-custom-api

    Here is a code sample for how you can implement that custom api in Business Central

    page 50101 SalesHeaderCustomApi
    {
       
        APIGroup = 'SalesHead';
        APIPublisher = 'NorthW';
        APIVersion = 'v1.0';
        Caption = 'salesHeaderCustomApi';
        DelayedInsert = true;
        EntityName = 'salesHead';
        EntitySetName = 'salesHeads';
        PageType = API;
        SourceTable = "Sales Header";
       
        layout
        {
            area(content)
            {
                repeater(General)
                {
                    field(transportMethod; Rec."Transport Method")
                    {
                        Caption = 'Transport Method';
                    }
                    field(packageTrackingNo; Rec."Package Tracking No.")
                    {
                        Caption = 'Package Tracking No.';
                    }
                    field(shipmentMethodCode; Rec."Shipment Method Code")
                    {
                        Caption = 'Shipment Method Code';
                    }
                    field(shippingAdvice; Rec."Shipping Advice")
                    {
                        Caption = 'Shipping Advice';
                    }
                    field(shippingAgentCode; Rec."Shipping Agent Code")
                    {
                        Caption = 'Shipping Agent Code';
                    }
                    field(shippingAgentServiceCode; Rec."Shipping Agent Service Code")
                    {
                        Caption = 'Shipping Agent Service Code';
                    }
                }
            }
        }
       
    }
    I added the relevant shipping fields - you may not have to use all of them but i added them while i was at it.
    If you are not the one doing the AL development you can hand this to the AL developers and tell them you need a custom API like this implemented in order to be able to update the tracking information.
    Hope this helps you further.

     

  • Khungersumit Profile Picture
    40 on at

    Hi Inge M. Bruvik
    Happy New Year! 

    I tried what you suggested but I guess there is some issue.
    When I did step1 and then step3 the whole order was posted and moved to the Sales Invoice section. but I fulfilled only 1 article out of 2. but this is not a Partial Fulfillment CASE
    pastedimage1641376760418v2.png


    and for following which API would you suggest for the POSTING, I used this API => /companies({company_id})/salesOrders({salesOrder_id})/Microsoft.NAV.shipAndInvoice
    pastedimage1641376889256v3.png




  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Maybe it is me who have been a bit unclear or i do not completely understand you.

    For all lines that you do not want to post shipment for the shipQuantity needs to be set to zero (0)

    The same goes for the invoiceQuantity. All lines that you do not want to invoice must have invoiceQuantity set to zero (O).

    So how do the order lines look after you have set the shipQuantity and invoiceQuantity

    If you wanted to only to shipment and what happen is that invoice is being posted then the quantity to invoice must have had a value other than zero in the sales order the same goes for shipping.

    If lines you did not want to ship was shipped it can only happen if the quantity to ship is larger than zero on the sales line.

    Show how do the sales lines look after you have set the quantity but before you do the post?

    I hope this make sense to you ?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans