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

Announcements

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 787
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
    787 on at
    Attaching additional screen shots.
     
     
  • Verified answer
    Greg Kujawa Profile Picture
    787 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,042 Super User 2026 Season 1

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,077 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 1,068 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans