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

Notifications

Announcements

No record found.

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,380 Super User 2025 Season 2 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,473 Super User 2025 Season 2 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
    95,748 Super User 2025 Season 2 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,380 Super User 2025 Season 2 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

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 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans