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...
Answered

Automatic assign dimenions to customer card

(0) ShareShare
ReportReport
Posted on by 50

Hi, 

I added field to Dimensions table checkbox with name "Customer". Now I want to auto assign Dimension Value, when i create new Customer, after assigning customer number, the system will automatically assign the Customer dimension which will be the same as customer number.

I have the same question (0)
  • Suggested answer
    THE Italian Profile Picture
    Microsoft Employee on at

    Maybe this one could be helpeful

    www.encorebusiness.com/.../

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

    I don't think there is any out of the box functionality that does that.

    But if you use the customer template then you can define dimensions in the template. That is what is there out of the box.

    pastedimage1659398889203v2.png

    To really do what you ask for you will have to do a customization.

    You should also be aware that the customer no. basically is on all transactions in the system that origins from a customer transactions.

    In the ledger tables you will typically find them by using the two fields source type and Source no.

    Filter on source type = customer and Source No = customer no. and you will have every transaction related to that customer.

    Basing your reporting on that could be an alternative to do a customization.

  • Suggested answer
    YUN ZHU Profile Picture
    102,476 Super User 2026 Season 1 on at

    Hi, this can be customized, and not very difficult.

    You can add your code to OnInsert (Table) Trigger of Customer table.

    More details: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/triggers-auto/table/devenv-oninsert-table-trigger

    In the code, you need to insert the value of Dimension Value (349) first (Customer No.), and then insert it into Default Dimension (352)

    pastedimage1659399550539v2.png

    pastedimage1659399430833v1.png

    Hope this helps.

    Thanks.

    ZHU

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

    Hi Tony00001 ,

    its required a customization, to create a new dimension and attach to the customer card, Please consult with your Development partner to help on this.

  • Tony00001 Profile Picture
    50 on at

    Can I ask for any code example? I'm newbie.

  • Verified answer
    YUN ZHU Profile Picture
    102,476 Super User 2026 Season 1 on at

    Hi, just a simple example, hope this helps.

    tableextension 50115 ZYDimensionExt extends Dimension
    {
        fields
        {
            field(50100; IsCustomer; Boolean)
            {
                Caption = 'Is Customer';
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 50115 ZYDimensionsExt extends Dimensions
    {
        layout
        {
            addafter("Filter Caption")
            {
                field(IsCustomer; Rec.IsCustomer)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    tableextension 50116 ZYCustomerExt extends Customer
    {
        trigger OnAfterInsert()
        var
            Dimension: Record Dimension;
            DimensionValue: Record "Dimension Value";
            DefDimension: Record "Default Dimension";
        begin
            Dimension.Reset();
            Dimension.SetRange(IsCustomer, true);
            if not Dimension.FindFirst() then
                exit;
            if not DimensionValue.Get(Dimension.Code, Rec."No.") then begin
                DimensionValue.Init();
                DimensionValue.Validate("Dimension Code", Dimension.Code);
                DimensionValue.Validate(Code, Rec."No.");
                DimensionValue.Insert();
            end;
    
            DefDimension.Init();
            DefDimension."Table ID" := 18;
            DefDimension."No." := Rec."No.";
            DefDimension.Validate("Dimension Code", DimensionValue."Dimension Code");
            DefDimension.Validate("Dimension Value Code", DimensionValue.Code);
            DefDimension.Insert();
        end;
    }

    pastedimage1659578050273v1.png

    pastedimage1659578100075v3.png

  • Tony00001 Profile Picture
    50 on at

    Thanks so much, I did a little modification to code, and works perfectly.

  • Mai lah Profile Picture
    25 on at

    Hi, when i'm traying to do this with Customer Country dimensions, it doesn't work.

    I mean i got automaticaly addedd as Customer dimension, no as Customer Country.

    My intention is, to automatically adding to Dimension Default, which is taking by Dimension Value.

    Any idea how to do this? I tried everything i guess.

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

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 694 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 481 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 328 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans