Per-Tenant and AppSource Extensions
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 10 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Advanced Deployment: Per-Tenant and AppSource Extensions
Introduction: The Architecture of Modern Business Applications
In the evolving landscape of cloud-based enterprise resource planning (ERP) systems, the way we deliver functionality to users has fundamentally shifted. Gone are the days of monolithic, on-premises customizations that were difficult to upgrade and prone to breaking during system updates. Today, we operate in a world of modular extensions, where functionality is delivered through isolated packages that exist alongside the core application. Understanding the distinction between Per-Tenant Extensions (PTEs) and AppSource Extensions is critical for any developer or system architect working in modern cloud environments.
These two deployment models represent the primary ways to extend the capabilities of a system without altering the base code. Per-Tenant Extensions are highly customized, private solutions tailored to the specific needs of a single organization. In contrast, AppSource Extensions are standardized, multi-tenant solutions designed for a broad market, adhering to strict quality and validation standards. Choosing the right path—or understanding when to combine them—determines the long-term maintainability, scalability, and cost-effectiveness of your development efforts. This lesson explores the technical nuances, deployment strategies, and best practices for both models.
Not read yet
Understanding Per-Tenant Extensions (PTEs)
Per-Tenant Extensions are essentially custom applications developed specifically for one customer environment. They allow organizations to build proprietary logic, unique integrations, or industry-specific workflows that do not exist in the base product. Because these are private, they do not require the rigorous validation process mandated by public marketplaces, making them an excellent choice for rapid, internal development cycles.
The Lifecycle of a PTE
When you build a PTE, you are responsible for the entire lifecycle, from initial development and testing to deployment and ongoing maintenance. Since you are not sharing the code with other organizations, you have full control over the versioning and release schedule. However, this also means you carry the full burden of ensuring that your code remains compatible with the core platform’s frequent automatic updates.
When to Choose a PTE
You should consider a Per-Tenant Extension when your requirements meet the following criteria:
- Highly Proprietary Logic: The functionality involves sensitive intellectual property or business processes that are unique to your organization.
- Custom Integrations: You need to connect the ERP system with internal, non-public APIs or local legacy systems that are not relevant to the general public.
- Rapid Iteration: You need to deploy features quickly based on internal feedback, without waiting for external validation cycles.
- Niche Requirements: The feature solves a problem that is so specific to your company's workflow that it would never gain traction as a commercial product.
Callout: PTE vs. AppSource - The Scope of Influence The fundamental difference between these two models lies in the scope of data and accessibility. A Per-Tenant Extension is confined to a single environment (or a single customer's tenant), meaning it has no impact on other organizations. An AppSource extension, however, is a global citizen. It must be designed to be "tenant-agnostic," meaning it cannot assume the presence of specific data or configurations that might be unique to one company. If your code breaks for one AppSource user, it potentially breaks for thousands of users globally.
Not read yet
Deep Dive into AppSource Extensions
AppSource Extensions, often referred to as ISV (Independent Software Vendor) solutions, are designed for the public market. They are installed via a centralized marketplace, allowing other users to discover, evaluate, and install your solution. This model requires a higher level of architectural discipline, as your code must be robust enough to handle a wide variety of customer configurations and data structures.
The Validation and Certification Process
Unlike PTEs, AppSource extensions undergo a mandatory technical validation process. Microsoft or the relevant platform provider reviews your code to ensure it follows best practices, adheres to performance guidelines, and does not conflict with the base application or other extensions. This process ensures that the marketplace remains a reliable source of high-quality software, but it also adds significant time and effort to your development timeline.
Key Requirements for AppSource
To successfully publish an extension to AppSource, you must adhere to strict standards:
- Strict Dependency Management: You must clearly define which versions of the base application your extension supports.
- Telemetry and Error Handling: You must implement robust logging and error handling so that you can diagnose issues remotely without having access to the customer's database.
- Upgrade Paths: You must provide clear upgrade paths for your users. When you release version 2.0, version 1.0 users must be able to upgrade without losing data or breaking their business processes.
- No Direct Modification of Base Objects: You must use proper extension points (events, interfaces, and table extensions) rather than trying to modify base code directly.
Not read yet
Technical Implementation: Deployment Strategies
Deploying these extensions involves different tools and permissions. For PTEs, you typically use the platform's administration center, uploading the compiled .app file directly. For AppSource, you use a dedicated partner portal that manages the submission, validation, and release workflow.
Preparing an Extension for Deployment
Regardless of the model, the core development process remains largely the same. You write your code in a development environment, compile it into an app package, and test it against the current version of the base platform.
Example: Defining a Table Extension
In both PTEs and AppSource, you will often need to extend existing tables. Here is a basic example of adding a custom field to a customer table:
tableextension 50100 "Customer Extension" extends Customer
{
fields
{
field(50100; "Custom Loyalty Score"; Integer)
{
Caption = 'Loyalty Score';
DataClassification = CustomerContent;
}
}
}
Note: Always ensure your
DataClassificationis set correctly. For AppSource, failing to classify data correctly is a common reason for validation failure. It is a security and compliance requirement that helps the platform understand how to handle, export, and delete data according to GDPR and other privacy regulations.
Automating the Deployment Process
Manual deployment is prone to error. Whether you are managing a PTE or an AppSource app, you should aim for automated CI/CD (Continuous Integration/Continuous Deployment) pipelines.
- Version Control: Store all your AL code in a repository like Git.
- Build Server: Use a build agent (like GitHub Actions or Azure DevOps) to compile your code and run automated tests.
- Deployment Task: Once the tests pass, the build agent can automatically push the
.appfile to your test environment or submit it to the AppSource validation portal.
Not read yet
Best Practices for Long-Term Maintenance
Maintaining extensions—especially those used by multiple clients—is a significant undertaking. The goal is to minimize "technical debt," which is the cost of additional rework caused by choosing an easy, short-term solution instead of a better, long-term approach.
1. Leverage Events and Interfaces
Avoid "hard-coding" logic that depends on specific base objects. Instead, use events to hook into standard processes. If you need to perform an action after a sales order is posted, subscribe to the OnAfterPostSalesOrder event. This keeps your code decoupled from the base application, making it much easier to handle future platform upgrades.
2. Implement Comprehensive Telemetry
Telemetry is your window into the customer's environment. By sending events to an Application Insights instance, you can monitor how your code performs in the wild. If a user encounters an error, you can see the stack trace and the state of the variables at the time of the crash. Without telemetry, you are essentially flying blind.
3. Design for Multi-Tenancy
Even for PTEs, you should treat your code as if it were multi-tenant. Do not assume that your app is the only one running in the environment. Other extensions might be modifying the same tables, or other users might have different regional settings. Write code that is defensive—check for the existence of data, handle null values gracefully, and never assume that a specific record will always exist.
4. Semantic Versioning
Always follow semantic versioning (Major.Minor.Patch).
- Major: Breaking changes that require the customer to change their processes or update their configuration.
- Minor: New features that are backward compatible.
- Patch: Bug fixes that do not change the existing behavior.
Callout: The Importance of Automated Testing In the world of cloud extensions, manual testing is not enough. Because the platform updates automatically on a frequent schedule, you need an automated test suite that runs every time you push a change. If your tests fail, your build fails. This creates a "safety net" that allows you to refactor code with confidence, knowing that you haven't broken existing functionality.
Not read yet
Common Pitfalls and How to Avoid Them
Even experienced developers fall into common traps. Recognizing these early can save hundreds of hours of debugging and maintenance.
Pitfall 1: Over-Engineering the Solution
It is tempting to build a "Swiss Army Knife" extension that solves every potential problem. However, complex code is harder to maintain and more likely to contain bugs. Focus on the core requirement. If you find yourself adding complex logic to handle edge cases, pause and ask if there is a simpler way to achieve the goal.
Pitfall 2: Neglecting Performance
In a cloud environment, you share resources with other tenants. If your code performs heavy calculations on the main thread, it can slow down the entire system for the user. Always offload heavy processing to background tasks or job queues. Use efficient queries and avoid nested loops that iterate over large tables.
Pitfall 3: Failing to Manage Dependencies
If your extension depends on another app, be explicit about it in your app.json file. If you don't define your dependencies correctly, your app might fail to install or crash unexpectedly when the dependent app is updated.
Pitfall 4: Ignoring UI/UX Standards
An extension should look and feel like part of the core product. Use standard controls, follow the platform’s design guidelines, and ensure that your fields and actions are placed logically. If your extension looks like an "add-on" that doesn't fit, users will be less likely to adopt it.
Not read yet
Comparison: Per-Tenant vs. AppSource
| Feature | Per-Tenant Extension (PTE) | AppSource Extension |
|---|---|---|
| Audience | Single Customer | Public Market |
| Validation | None (Internal) | Strict (Microsoft/Partner) |
| Distribution | Direct Upload | AppSource Marketplace |
| Maintenance | Developer-Managed | Developer-Managed + Compliance |
| Customization | Unlimited | Restricted (Must be Generic) |
| Cost | Internal Resource Cost | High (Validation/Support/Marketing) |
Step-by-Step: Deploying a Per-Tenant Extension
If you have developed a PTE and are ready to deploy it to a client's production environment, follow these steps to ensure a smooth transition:
- Environment Preparation: Ensure the target environment is on the same (or compatible) version of the platform as your development environment.
- Compile the App: In your development environment (e.g., VS Code), run the package command to generate the
.appfile. - Validation: Run your automated test suite one last time against a production-like database to ensure no data-specific issues exist.
- Admin Center Access: Log in to the platform's Admin Center using an account with administrative privileges.
- Extension Management: Navigate to the "Extensions" or "Environment" section and select the option to "Upload" or "Deploy" a new extension.
- Upload and Install: Select your
.appfile and confirm the installation. The platform will validate the manifest and install the extension, making it available to users. - Post-Deployment Verification: Once the installation finishes, log into the ERP system and verify that your new fields, pages, or logic are functioning as expected.
Not read yet
Advanced Considerations: Handling Data Upgrades
One of the most challenging aspects of maintaining any extension is managing data schema changes. What happens when you rename a field or move a piece of data to a new table?
The Data Upgrade Codeunit
Modern platforms provide a specific mechanism for handling these scenarios, usually via a "Data Upgrade" codeunit. This codeunit runs automatically during the installation or update process. You can use it to:
- Migrate data from an old field to a new one.
- Update record states based on new business logic.
- Validate data integrity before the new version goes live.
Always write your upgrade code defensively. Check if the old field exists before trying to read from it. Use if statements to ensure that you only run the migration once. If your upgrade fails, the entire installation will roll back, which protects the customer's data from corruption.
codeunit 50101 "Data Upgrade"
{
Subtype = Upgrade;
trigger OnUpgradePerCompany()
var
Customer: Record Customer;
begin
// Example: Move data from old obsolete field to new field
if Customer.FindSet() then
repeat
if Customer."Obsolete Field" <> '' then begin
Customer."New Field" := Customer."Obsolete Field";
Customer.Modify();
end;
until Customer.Next() = 0;
end;
}
Not read yet
Security and Compliance
When developing extensions, especially those involving financial or personal data, you must prioritize security.
- Permissions: Always adhere to the principle of least privilege. Your extension should only request the permissions it absolutely needs to function. Do not ask for "Super" or "Admin" access if you only need to read a specific table.
- Data Privacy: If your extension captures user information, ensure you provide mechanisms for data export and deletion as required by regulations like GDPR.
- Input Validation: Never trust user input. Always validate data in your pages and codeunits to prevent SQL injection or other malicious activities, even if the platform has built-in protections.
Common Questions (FAQ)
Q: Can I convert a Per-Tenant Extension to an AppSource extension later?
A: Yes, but it requires significant work. You will likely need to refactor the code to remove any tenant-specific assumptions, implement more robust error handling, and prepare for the external validation process. It is often easier to plan for AppSource from the beginning if you think there is even a small chance you will want to sell the solution later.
Q: How do I handle bugs in a production environment?
A: Use your telemetry data to identify the cause. Once identified, fix the bug in your development environment, increase your version number, and deploy the update. The platform will recognize the new version and perform an in-place update for the customer.
Q: What happens if my extension conflicts with another installed extension?
A: This is a common issue in open ecosystems. While the platform tries to prevent direct conflicts, it cannot always predict how two independent extensions will interact. This is why thorough testing with common third-party apps is a best practice. If a conflict occurs, you may need to reach out to the other developer or change your approach to avoid the specific table or page area.
Not read yet
Key Takeaways for Successful Deployment
- Distinguish Your Strategy: Understand the fundamental differences between the private, rapid-development nature of Per-Tenant Extensions and the public, high-standard nature of AppSource extensions.
- Prioritize Maintainability: Use modern architectural patterns like events and interfaces to decouple your code from the base application, ensuring long-term compatibility with platform updates.
- Invest in Automation: Manual deployment is a recipe for failure. Build CI/CD pipelines that include automated testing to ensure every release is high quality and regression-free.
- Embrace Telemetry: You cannot fix what you cannot see. Implement robust logging and monitoring to gain visibility into your extension's performance and behavior in production environments.
- Design for Multi-Tenancy: Even if your current project is for a single client, write your code as if it were to be used by thousands. This defensive programming style leads to fewer bugs and a more robust product.
- Follow the Lifecycle: From initial development to data migration and versioning, follow a disciplined lifecycle. Do not skip testing, do not ignore validation requirements, and always plan for the "next" version.
- Security is Non-Negotiable: Always apply the principle of least privilege and ensure your code complies with data privacy laws. Protecting the customer's data is just as important as delivering new functionality.
By following these principles, you move beyond being just a developer and become a true solution architect. You will create extensions that are not only functional but also reliable, secure, and easy to maintain, providing real value to the businesses that depend on your work. The key to long-term success in this field is not the complexity of the code you write, but the discipline you bring to the deployment and maintenance process.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
Spend your points to unlock exam-style practice questions
Spend points to unlock MB-820 exam-style practice questions.
Practice for MB-820