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

Apply customer template via c/al

(0) ShareShare
ReportReport
Posted on by 50

I'm creating new customers via c/al extensions. I would like to apply one template that was created in business central to the new customers.

It seems that I have to use the Codeunit "Customer Templ. Mgt."

Anyone that would help on how to apply the template to the new customers via C/AL?

I have the same question (0)
  • Verified answer
    Binesh Profile Picture
    7,887 on at

    Hello,

    See the below code for your reference and update it as per your needs if required.

    procedure CreateCustomerFromTemplate(var Customer: Record Customer; CustTempCode:code[20])
        var
            CustomerTempl: Record "Customer Templ.";
            CustTempMgmt: codeunit "Customer Templ. Mgt.";
        begin
            if not CustomerTempl.Get(CustTempCode) then 
                Error('Customer template code not exist.')
           
            Customer.SetInsertFromTemplate(true);
            Customer.Init();
            CustTempMgmt.InitCustomerNo(Customer, CustomerTempl);
            Customer."Contact Type" := CustomerTempl."Contact Type";
            Customer.Insert(true);
            Customer.SetInsertFromTemplate(false);
    
            CustTempMgmt.ApplyCustomerTemplate(Customer, CustomerTempl);
        
        end;

  • Ricardo Jacobsen Profile Picture
    50 on at

    That really helps, thank you very much.
    Another question, if you can reply..
    How do I select a specific template? 
    For example, I saved this CLIENT template and I want to select it for applying via C/AL.

    pastedimage1658801650184v2.png

    It seems that CustomerTempl: Record "Customer Templ." is using a standard template from business central. Am I correct?

  • Verified answer
    Ricardo Jacobsen Profile Picture
    50 on at

     Binesh 

  • Binesh Profile Picture
    7,887 on at

    Hello Ricardo,

    Before going to further discussion, I want to know how the "name" can be correct answer of your query which you have verified for your statement?

    Don't put false as this is a community channel which helps to other members as well when they have similar kind of query by seeing the verified answer.

    Hope you can understand my concern, and also for new query create a new question instead of making a chat, by this way you can also help other members to find the query.

  • Ricardo Jacobsen Profile Picture
    50 on at

    Hello Binesh . I'm sorry but I didn't get what you mean?

    Which name you are talking about?

    I didn't put any name as correct answer.

    Sorry I'm new to the forum I'm trying to understand what is going on.

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,055 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,063 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 1,014 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans