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

Customer dimension on Creation

(1) ShareShare
ReportReport
Posted on by 105
Dear all,
 
How can I ensure that while user is creating a new customer he should fill default dimension? I tried to write a few lines of code in customer table extension and call it on customer card page Onpageclose trigger but it is not meeting the requirement.
 
procedure CheckDim()
 
    var
        vDims: Record /Default Dimension/;
    begin
        vDims.SetRange(/Table ID/, Database::Customer);
        vDims.SetRange(/No./, rec./No./);
        vDims.SetRange(/Dimension Code/, '');
 
        if vDims.FindSet() then begin
            if vDims./Dimension Code/ = '' then
            Error('Customer Dimension is required');
            // begin
            //     if vDims./Dimension Value Code/ = '' then
            //         Error('Customer Dimension is required');
            // end;
        end;
    end;
 
I have the same question (0)
  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,414 User Group Leader on at
    Hi,
     
    You are approaching it incorrectly.
     
    Here is how I would suggest approaching this - 
     
    1. When a new customer created, using oninsert subscriber make Blocked as All.
    2.  When user tries to Blocked as " ", then check Default Dimension.
    3. If you only want to do it during first time (creation), then add a Boolean "Dimension Checked".
    4. If you do 3, then after Blocked is set to " ", set that Boolean true and Do 2 only if Dimension Checked = false.
     
    Here is code that you should be using - 
     
     
        Procedure CheckDefaultDimension(var Customer: Record Customer)
        var
            DefaultDimension: Record "Default Dimension";
        begin
            DefaultDimension.SetRange("Table ID", Database::Customer);
            DefaultDimension.SetRange("No.", Customer."No.");
            If DefaultDimension.IsEmpty() then
                Error('Default Dimension is not set for this customer. Please set the default dimension for this customer.');
        end;
     
    Hope it helps.
     
    Regards,
    Saurav Dhyani
  • Maro9595 Profile Picture
    105 on at
    Thank you for your valuable replay Saurav,
    but when I select OK the page close and customer is still created
     
  • Verified answer
    Mustafa Omerbegović Profile Picture
    1,477 Moderator on at
    Hello,
    I believe that Saurav.Dhyani gave you the correct answer, but I do not know why you do not use Customer Template for this purpose.
     
    Why write code when you can use native functionality that will work well?
     
    Customer Templates -> Dimensions -> Define default dimensions for customer template
     
     
    Afer you create new customer with that template you will have defined dimension on customer card.
    Templates gives you the opportunity to define another customer data which will automatically applied to new customer cards.
     
     
    Greeting
  • Suggested answer
    YUN ZHU Profile Picture
    98,062 Super User 2026 Season 1 on at
    Hi, I would like to mention that the standard environment can do it, but it will be checked at post time, not at creation time.
     
    Hope this helps.
    Thanks.
    ZHU
  • Verified answer
    Saurav.Dhyani Profile Picture
    14,414 User Group Leader on at
    Hi @Maro9595,
     
    It will be created but you will not be able to unblock it.
     
    Until its unblocked you will not be able to do any transaction for that customer. 
     
    Additionally, as @Mustafa Omerbegović suggested, if that is something you can do. It's a great suggestion.
     
     
    Regards,
    Saurav Dhyani

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,032 Super User 2026 Season 1

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,049 Super User 2026 Season 1

#3
YUN ZHU Profile Picture

YUN ZHU 1,029 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans