Business Central: How to assign Serial and Lot No. from Warehouse Receipt using webservices

The following post is related to how to manage the number of series and lots numbers to Items that are in the Warehouse Receipt.

This article shows how you can create a webservice in Business Central that allows you to Create, Obtain and Delete Reservation Entries in order to manage series and number of lots.

Project Overview

Basic Concepts

Next, I leave a bit of necessary theory that must be considered in order to carry out the assignment process.

Track Items with Serial, Lot, and Package Numbers

You can assign serial numbers, lot numbers, and package numbers to any outbound or inbound document, and its posted item tracking entries are displayed in the related item ledger entries. You perform the work on the Item Tracking Lines page, which you can open from an inbound or outbound document.

The matrix of quantity fields at the top of the Item Tracking Lines page displays the quantities and sums of item tracking numbers being defined on the lines. The quantities must correspond to those of the document line, which is indicated by 0 in the Undefined fields.

As a performance measure, application collects the availability information on the Item Tracking Lines page only once, when you open the page. This means that application does not update the availability information during the time that you have the page open, even if changes occur in inventory or on other documents during that time.

Taken from https://learn.microsoft.com/

Item Tracking

Through Item Tracking, we can track inventory items even in complex warehouse configurations with numbers that are specific to each item, whether as an individual object, as a lot, or as a package, internal warehouse movements, and documents. incoming and outgoing.

Items with serial and lot numbers can be traced both backward and forwards in the supply chain. This is useful for general quality control and product recall.

For more information on how to create and configure them, I share the following official Microsoft https://learn.microsoft.com/

Next, I share the configurations that I used to develop this Post.

Configuration of Item Tracking used for Series No.:

Configuration of Item Tracking used for Lot No.:

Configuration of Item Tracking used for Misc.:

Location Card

Business Central

Warehouse Receipt

The idea of this post is to start from the Warehouse Receipt, which we will assign via Webservices (through Postman) series and Lot Number to the Item we are receiving.

Item Tracking

If we open the Item Tracking card we can see that there are no associated Series or Lots.

Create Reservation Entries

Now, we will use our first webservices, which will allow us to register the Series and Lot of the item.

Postman:

URL: https://api.businesscentral.dynamics.com/v2.0/{{TenantId}}/{{SandboxName}}/ODataV4/ItemTrackingManagementIS_CreateReservationEntry?company='CRONUS%20USA%2C%20Inc.'
BODY:
{
  "WarhouseReceiptNo": "WHSE REC-00012",
  "ItemNo": "1001",
  "SourceNo": "106016", //PO Number
  "SourceRefNo": "10000",
  "Qty": "1",
  "SerialNo": "Serial20004",
  "LotNo": "LOT20000",
  "ExperationDate": "2030-12-22"
}

This is what the execution looks like in Postman. The result is the Reservation Entries table with the records associated with the Item belonging to that Warehouse Receipt.

Business Central

Now if we go to Business Central we can see that the information was created correctly.

Code AL

The heart of this webservices is to use the Codeunit “Create Reserv. Entry” which is native to Business Central and allows us to create and configure Reservation Entries, this is the table responsible for registering our Serial and Lot Numbers.

Get Reservation Entries

The following process allows you to obtain an Entry Reservation created.

Postman

The result is the Reservation Entries table with the records associated with the Item belonging to that Warehouse Receipt.

URL: https://api.businesscentral.dynamics.com/v2.0/{{TenantId}}/{{SandboxName}}/ODataV4/ItemTrackingManagementIS_GetReservationEntry?company='CRONUS%20USA%2C%20Inc.'
BODY:
{
  "WarhouseReceiptNo": "WHSE REC-00012",
  "ItemNo": "1001",
  "SourceNo": "106016",
  "SourceRefNo": "10000",
}

Business Central

Code AL

Delete Reservation Entry

This process allows you to eliminate a Reservation Entry created, the result will be returned if there are elements of a Reservation Entry associated with the Warehouse Receipt Item.

Postman

URL: https://api.businesscentral.dynamics.com/v2.0/{{TenantId}}/{{SandboxName}}/ODataV4/ItemTrackingManagementIS_DeleteReservationEntry?company='CRONUS%20USA%2C%20Inc.'
BODY:
{
  "WarhouseReceiptNo": "WHSE REC-00012",
  "ItemNo": "1001",
  "SourceNo": "106016",
  "SourceRefNo": "10000",
  "Qty": "1",
  "SerialNo": "Serial20004",
  "LotNo": "LOT20000",
  "ExperationDate": "2030-12-22"
}

Business Central

Code AL

Get Tracking Specification

Once we post the Warehouse Receipt, the Reservation Entries information is transferred to the Tracking Specification that would correspond to the posted Reservation histories.

Postman

URL: https://api.businesscentral.dynamics.com/v2.0/{{TenantId}}/{{SandboxName}}/ODataV4/ItemTrackingManagementIS_GetTrackingSpecification?company='CRONUS%20USA%2C%20Inc.'
BODY:
{
  "ItemNo": "1001",
  "SourceNo": "106016",
  "SourceRefNo": "10000"
}

Business Central

If we were to go back to the Item Tracking Lines of the Warehouse Receipt, we would see that the “Quantity Handled (Base)” field changed to 1 and the “Quantity to Handle (Base)” field changed to 0.

We could also open the Reservation Entries table and we would see that it is empty, since the information at this moment is in the Tracking Specification

Now, if we go to the Warehouse Put Away, we can see how the Warehouse Put Away Line has the corresponding Serial and Lot Number information.

Code AL

Conclusion

With this Post we have shown how you can create and manage Series and Lot Numbers through simple web services.

For more information on how to use Postman to connect with Business Central, I leave the link to this previous Post.

If you need information on how to use and configure Outh2 I leave the link to this previous Post.

In the following Github link, I share the code used.

If you liked this post share it.

I hope it helped you.

2 thoughts on “Business Central: How to assign Serial and Lot No. from Warehouse Receipt using webservices

  1. Baran Deniz GUNDUZ Reply

    Thank you for that amazing work. Saved a lot of time for me. Cheers <3

Leave a Reply

Your email address will not be published. Required fields are marked *