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

AL Code Creating a New Item

(1) ShareShare
ReportReport
Posted on by 385
So I have an AL Codeunit that successfully creates a new item. Some new items are going to be FIFO, while others are going to be Specific cost. So I have created two different Item Templates for each use case. My procedure successfully creates a new item based off the FIFO template, but fails when creating a new item off the Specific template. Here's a snippet of my procedure.
 
//
 
 
The failure when I call this procedure comes back as
 
{    /error/: {        /code/: /Application_FieldValidationException/,        /message/: /Item Tracking Code must have a value in Item: No.=1095. It cannot be zero or empty.  CorrelationId:  9a108fe3-40eb-4c41-be98-1606f1c3ef47./    }}
I pull up this template and can clearly see the Item Tracking Code as well as Serial Nos. fields are properly defined. Still struggling with what could be causing the hiccup?
  • Verified answer
    Greg Kujawa Profile Picture
    385 on at
    AL Code Creating a New Item
    Figured it out. Due to the validation checks that come into play (e.g. - you have to define the Item Tracking Code and Serial Nos. before flagging the Specific costing method in the web UI), I switched things around in my AL code. This below works. Just in case it helps anyone else running into the same thing!
     
  • Greg Kujawa Profile Picture
    385 on at
    AL Code Creating a New Item
    Attaching additional screen shots.
     
     

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans