Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

AL Code Creating a New Item

(1) ShareShare
ReportReport
Posted on by 289
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
    Greg Kujawa 289 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
    Greg Kujawa 289 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,885 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,569 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans