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...
Suggested answer

Scan items instead of using Item Number

(1) ShareShare
ReportReport
Posted on by 9
Hi-
 
Frustrated BC user here. I am looking to do a very simple task. I want to add a field (/Barcode/) to certain tables (Item Table [shown below], Production BOM Lines, etc.). Instead of selecting the Item Number, I would like to scan the item (using Item Reference Table) with my scanner. This is becoming incredibly complicated to do something so simple. 
 
I can't add the field through Design or Personalize as the existing tables don't contain the Item Reference fields. I've tried approximately 80 combinations of AL code, none which satisfy what I'm trying to do. Flow Fields, Table Relations, actions, triggers, pulling my hair - none have worked.
 
After reading, re-reading, and re-re-reading AL Dev guide, I just cannot understand how, when, where, or why to use a trigger, a validation. I've coded in Python for quite a few years at a basic level, but for some reason doing simple tasks in AL is monumental for me. To me, AL is just downright confusing and non-sensical, and Microsoft's website doesn't help whatsoever and if anything, is more confusing.
 
For example, on the table extension I created for Item, the field is not automatically populating - I have to use the drop down and manually select the item number, which it then populates (see screenshot). In addition, on Production BOMs, the inverse does not work either (e.g., scan the barcode to populate the Item Number, Description, UoM, etc.) - I must select the item number first, which then makes my whole idea pointless. 
 
Thanks you for any advice,
 
Nick
 
 
 
 
 
Code (50105 is Item TblExt and 50104 is Production BOM Line TblExt): 
 
tableextension 50105 ItemExtension extends Item
{
fields
{
field(50105; Barcode; Code[50])
{
Caption = 'Barcode';
DataClassification = CustomerContent;
ExtendedDatatype = Barcode;
TableRelation = /Item Reference/./Reference No./ where(/Item No./ = field(/No./));
}
}
}
 
tableextension 50104 BOMTableExtension extends /Production BOM Line/
{
fields
{
field(50104; ItemReferenceNo; Code[50])
{
Caption = 'Item Reference No';
DataClassification = CustomerContent;
ExtendedDatatype = Barcode;
TableRelation = /Item Reference/./Reference No./ WHERE (/Item No./ = field(/No./));
/*trigger OnValidate()
var
ItemRef: Record /Item Reference/;
begin
if Type = Type::Item then
begin
ItemRef.SetRange(/Item No./, /No./);
if ItemRef.FindFirst() then
ItemReferenceNo := ItemRef./Reference No./
end;
end;*/
}
}
}
  • Suggested answer
    Ben Baxter Profile Picture
    5,467 Super User 2025 Season 1 on at
    Scan items instead of using Item Number
    I don't think you need to program anything here.  The out-of-the-box capability should work for you.
     
    You don't need to add a field to the Item Card, in fact this may cause issues for the User if the data doesn't make it to the Item Reference table.  Enter the Barcode value in the Item Reference table as a Type = Barcode.  On the Component Journal, display the Item Reference No. field.  When scanning the barcode ensure you are on the Item Ref. Field.  The system will receive the input and lookup the related Item.
     
    Before you spend a lot of time programming this, if your scanner is a handheld scanner (not USB/Bluetooth), you should look up the ISV Extensions for this functionality.  Your partner may already have a preferred solution they can recommend to you.
     
    I hope this helps resolve your issue, if so please mark it as a Verified Answer to help other forum users.
     
    Best Regards,
    Ben Baxter
    Accent Software Inc

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,983 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans