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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Business Central

(0) ShareShare
ReportReport
Posted on by 208

I want to show alert message if any items  having location code more than one in item bin content how can be done in Al code? 

  • Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You have to decide first where you want to alert this notifications, and after that you can search if any Event is available for that trigger, and customize that.

    learn.microsoft.com/.../warehouse-how-to-set-up-locations-to-use-bins

    Thanks.

  • Dividutt Profile Picture
    208 on at

    I want to show alert on mail, if more than one location code is entered in item bin content of items..can you suggest how can be done in Al code as I am beginner..

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    When you want to send an email?

    Thanks

  • Dividutt Profile Picture
    208 on at

    When there is more than one location code in item bin content then should trigger a mail from business Central with all table details..

  • Suggested answer
    Amit Profile Picture
    2,563 on at

    hello,

    pls specify the event, then accordingly, will provide solution

    regards

    Amit Sharma

    www.erpconsultors.com

    press yes if info is useful.

  • Dividutt Profile Picture
    208 on at

    when we look at the Item Card and then there are Items which have more than one Bin Location (Item Bin Content) ,so needed to print the item number on message dialog that has more than one location code, i have done the al code but not getting proper result on message.

           2548.bin-content.png

    this is code:

    procedure skuloc()
        var
           rec_item: Record Item;
            rec_bin: Record "Bin Content";
            multi: Text[2048];
            itemloc: Text[100];

        begin

            if rec_item.FindSet() then
                repeat
                    if itemloc <> rec_bin."Location Code" then begin

                        rec_bin.SetRange("Location Code", rec_bin."Location Code");

                        if rec_bin.Count > 1 then begin

                            if itemloc = '' then
                                itemloc := rec_bin."Location Code";


                            Message('%1', rec_item."No.");
                        end;

                    end;

                until rec_item.Next() = 0;
        end;
  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    I do not think the system will allow you to register different locations in the same bin.

    So what you really want to know is if you have the same item in different locations?

  • Dividutt Profile Picture
    208 on at

    YES, so if any item have more than one bin location code then i needed to trigger alert or display message that item has more than one location code.

    so needed al code to display that.

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    You can try this code where you can send in the item you want to check.

    codeunit 50100 ItemTools
    {
        procedure CountLocations(Item: Record Item)
        var
            loaction: Record Location;
            NoOfLocations: Integer;
            LocationString: Text;
        begin
            NoOfLocations := 0;
            LocationString := '';
            if loaction.FindSet(false, false) then
                repeat
    
                    Item.Setfilter(Item."Location Filter", loaction.Code);
                    Item.CalcFields(Inventory);
                    If Item.Inventory > 0 then begin
                        NoOfLocations  = 1;
                        if NoOfLocations = 1 then LocationString := loaction.Code;
                        If NoOfLocations > 1 then LocationString := LocationString   ' '   loaction.Code;
                    end;
                until loaction.Next() = 0;
                if NoOfLocations >1 then Message('Item %1 is avalible on these %2 locations %3',Item."No.",NoOfLocations,LocationString);
    
        end;

  • Dividutt Profile Picture
    208 on at

    Ok thankyou will try and update.

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 728 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 545 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 328 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans