Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Create batch number with X++

Posted on by Microsoft Employee
Hi. I want to create batch number with specific format with X++ code. How can I do it? Regards
  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create batch number with X++

    Depends on where you'd want to apply this, but it would be something like this:

    inventBatch.inventBatchId = codeforyourspecificformat;

    inventBatch.itemId = _itemId;

    // since you create it manually through code, it could result in a duplicate, so check this:

    if (InventBatch::exist(inventBatch.itemId, inventBatch.inventBatchId))

    error("Batchnumber already exists");

    else

    inventBatch.insert();

    You can of course extend the filling of the other variables on the batch as you wish.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans