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

Notifications

Announcements

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 305
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,016 Super User 2025 Season 2 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

News and Announcements

Season of Giving Solutions is Here!

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 1,810

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 810 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 676 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans