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

Announcements

News and Announcements icon
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 323
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
I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,218 Super User 2026 Season 1 on at
    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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,028 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,366 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 1,175 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans