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

How to find/check if item is already exist in business central

(1) ShareShare
ReportReport
Posted on by 247
Hi Guys,
I want do the customization :
Giving an error on the item reference table if a barcode is entered but already exists on another item?
Is any way to do this.
 
For example:
I have open Item 0000005 ,then I click on Item reference action.It will open item reference page.
On that page ,I have enter the Reference type as ::Barcode & enter reference no:1234.Then,
I have open Item 0000006 ,then I click on Item reference action.It will open item reference page.
On that page ,I have enter the Reference type as ::Barcode & again enter same reference no:1234
Now that time it shows an error message: 'The Reference no is already exist for another item,
 
below is the 1st Item
Below is the 2nd Item
  • Suggested answer
    Mohana Yadav Profile Picture
    60,250 Super User 2025 Season 1 on at
    How to find/check if item is already exist in business central
    You can change as per your requirements.
     
        [EventSubscriber(ObjectType::Table, Database::"Item Reference", 'OnBeforeValidateEvent', "Reference No.", false, false)]
        local procedure ItemReferenceOnBeforeValidateEvent(var Rec: Record "Item Reference"; var xRec: Record "Item Reference"; CurrFieldNo: Integer)
        var
            ItemReference: Record "Item Reference";
        begin
            if Rec."Reference No." <> '' then begin
                ItemReference.SetRange("Reference Type", Rec."Reference Type");
                ItemReference.SetRange("Reference No.", Rec."Reference No.");
                if not ItemReference.IsEmpty() then
                    Error('Item Reference already exists.');
            end;
        end;
     

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans