Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Extension in Business Central

Posted on by 1,654

Hii,

How to install extension in one company of same Environment which has two company.

Thank you.

Categories:
  • MetaKa Profile Picture
    MetaKa on at
    RE: Extension in Business Central

    As YunZhu stated, the correct aproach is to make a setup page (card) for the extension where u can activate or deactivate the functionallity per company with a boolean and a procedure to get the enabled state from, in every place that is needed put a:

    if not enabled() then exit;

    and end the functionallity based on the configuration.

    The extension will be installed in all the companies, but the functionallities/pages will have a validation checking if its activated, this way

    ↑ This is the correct aproach in 95% ~100% of cases

    The other 5% could be a personalization extension where specifically u just need 1 functionalitty on 1 company, so u do the if getting the company.

    But even in this case i would go with a setup page, for the posibility of new companies in the future.

  • Jakob Gutzmann Profile Picture
    Jakob Gutzmann 18 on at
    RE: Extension in Business Central

    Hi,
    as others have said, extensions are installed for all companies within the same environment.

    If you have small blocks of code that should be executed in a company-specific way, you can nest them in an if-clause and check for the current company with 

    Database.CompanyName
    But I wouldn't suggest that for entire pages/tables, only small company-specific code blocks.
    Thanks,
    Jakob Gutzmann
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Extension in Business Central

    Hi, because of this, developers generally add settings pages to their extensions, which are only valid when the function is enabled.

    Thanks.

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Extension in Business Central

    Hi,

    Extension works through all the company in the same environment, but yes if you are intent to run any specific code in specific company you can use the method CHANGECOMPANY in your code, see below for more hints.

    learn.microsoft.com/.../record-changecompany-method

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Extension in Business Central

    We cannot. The app installed will execute in all companies.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans