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

Announcements

News and Announcements icon
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 841
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?
I have the same question (0)
  • Greg Kujawa Profile Picture
    841 on at
    Attaching additional screen shots.
     
     
  • Verified answer
    Greg Kujawa Profile Picture
    841 on at
    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!
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 589 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 453 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 328 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans