web
You’re offline. This is a read only version of the page.
close
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 583
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
    583 on at
    Attaching additional screen shots.
     
     
  • Verified answer
    Greg Kujawa Profile Picture
    583 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,990

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,576 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans