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

Assign a Customer to an Item

(1) ShareShare
ReportReport
Posted on by 72
Afternoon All, 
 
I am trying to assign a customer to an item, i have added the table extensions and page extension however how do i get this to transfer to the sales lines so that we can use this to filter the items based on customer or is there another way to do this. 
I have added the extension to the sales lines table however the boxes are there but they are not transffering from the item page to this. 
the end use for this is to have a list that is filterable by customer for the items as this is how we operate as a business as we dont sell the items we provide a service on them.
 
I have tried the below which didnt work as this was on the microsoft help but wasn't much help! 
 
tableextension 60100 CustomerParts extends Item
{
    fields
    {
        field(60100; /Customer Name/; Text[200])
        {
            Caption = 'Customer Name';
            FieldClass = FlowField;
            CalcFormula = lookup(Customer.Name where(/No./ = field(CustomerNo)));
        }
        field(60101; CustomerNo; code[20])
        {
            Caption = 'Customer No';
            TableRelation = Customer;
            trigger OnValidate()
            begin
                CalcFields(/Customer Name/);
            end;
        }
    }
    local procedure CopyFields()
    var
        dt: DataTransfer;
        dest: Record /Sales Line/;
        src: Record Item;
    begin
        dt.SetTables(Database::Item, Database::/Sales Line/);
        dt.AddFieldValue(src.FieldNo(CustomerNo), dest.FieldNo(CustomerNo));
        dt.AddSourceFilter(src.FieldNo(CustomerNo), '=%1', 'A');
        dt.CopyFields();
    end;
}
I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at
    Did you try to create a flowfield on Sales Line table based on the No. field of Sales Line to look at Customer No. of Item table?
  • Sam @ Mikris Profile Picture
    72 on at
    Hi, no I didn't! 
     
    I was simply trying to make it so that we when we entered new items into the inventory we could assign this to a customer so that we could filter the inventory per customer and not bring up like 100,000 or so items that we would have otherwise.
  • Suggested answer
    YUN ZHU Profile Picture
    99,978 Super User 2026 Season 1 on at
    Hi, Try the following approach, so that after you select item no. in Sales Line, CustomerNo. will be displayed.
     
    Hope this helps.
    Thanks.
    ZHU
  • Sam @ Mikris Profile Picture
    72 on at
    Brilliant, thank you! 
     
    Worked like a charm, all i need to do now is work out how to filter the lookup to the item to filter to the customer in the sales header and we are good to go!! 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,796 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 965 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 664 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans