Creating Profiles in AL

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 11 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Mastering Profile Development in AL: Customizing the User Experience

Introduction: Why Profiles Matter in Business Central

In the ecosystem of Microsoft Dynamics 365 Business Central, the user interface (UI) is not a one-size-fits-all experience. Different employees within an organization—such as a warehouse manager, a sales representative, or an accountant—require access to vastly different sets of data, tasks, and reports to perform their daily duties effectively. This is where the concept of Profiles comes into play. A Profile in AL (Application Language) acts as a blueprint for a specific user role, defining which pages, cues, and actions are displayed, and how the navigation menu is structured.

By mastering the development of Profiles, you gain the ability to tailor the application to the specific workflows of your users. This prevents "feature bloat," where users are overwhelmed by unnecessary buttons or data fields that do not pertain to their job, thereby increasing productivity and reducing training time. When you develop a Profile in AL, you are essentially curating the digital workspace, ensuring that the most relevant information is front and center. This lesson will guide you through the technical implementation of Profiles, the configuration of Role Centers, and the best practices for managing user experiences through AL code.

Not read yet

Understanding the Architecture of Profiles

At its core, a Profile is a metadata object in AL that binds a specific Role Center page to a user persona. When a user logs into Business Central, the system looks at the Profile assigned to their user account to determine which Role Center page to render as their "home page." However, a Profile does more than just assign a page; it serves as a container for personalization and configuration.

The Role of the Role Center

The Role Center is a specialized page object in AL (type RoleCenter) that acts as the dashboard for a user. It typically contains Cues (the colorful tiles that show counts of pending tasks), navigation menus (the top bar and the navigation pane), and part pages that show lists or charts. When you create a Profile, you are designating one of these Role Center pages as the default landing point for the users associated with that profile.

Configuration vs. Personalization

It is vital to distinguish between these two concepts early on. "Personalization" is something an end-user does to their own workspace—moving a column, hiding a field, or adding a bookmark. "Configuration," on the other hand, is a developer or administrator-level task. When you create a Profile and configure it, you are defining the default look and feel for everyone assigned to that profile. If you update the configuration, those changes are pushed to the users, providing a structured and consistent experience across the organization.

Callout: Configuration vs. Personalization Personalization is user-driven and stored in the user's personal settings, allowing them to adapt their workspace to their habits. Configuration is developer-driven and stored in the Profile object, providing a baseline experience that ensures users have access to the specific tools required for their job role.

Not read yet

Creating Your First Profile Object

To create a Profile in AL, you use the profile object type. This object is straightforward but carries significant weight in how the application behaves for the user. Below is a basic example of how to declare a Profile in your AL project.

Basic Profile Syntax

profile SalesManager
{
    Caption = 'Sales Manager';
    RoleCenter = "Sales Manager RC";
    Description = 'Profile for the Sales Manager role';
    Enabled = true;
    ProfileDescription = 'Provides access to sales orders, quotes, and customer reporting.';
}

In this example, we define a profile named SalesManager. The RoleCenter property points to the specific page object that acts as the dashboard. The Enabled property allows you to toggle the profile's availability without deleting the code, which is useful during testing or when phasing out old workflows.

Essential Properties of a Profile

When defining your Profile object, there are several properties you should consider to ensure the profile is useful and easy to manage:

  • Caption: This is the name the user will see in the "My Settings" or "Profiles" list. Use clear, descriptive names.
  • RoleCenter: This is the link to the actual page object (must be of type RoleCenter).
  • Enabled: A boolean that determines if the profile is selectable by users or administrators.
  • ProfileDescription: A text field for internal documentation, helping other developers understand the purpose of the profile.
  • Promoted: If set to true, this profile appears as a primary option for users to select.

Note: Always ensure that your Role Center page is properly defined with a RoleCenter layout, or the system will fail to render the interface correctly. A Role Center page should contain at least one Area(RoleCenter) section to hold the navigation and cues.

Not read yet

Advanced Customization: Customizing Profiles via AL

While the profile object sets the foundation, you often need to adjust how specific pages appear for that profile. You can do this using profileextension objects. These extensions allow you to modify the layout, actions, and visibility of pages specifically for users assigned to a profile, without impacting the global definition of those pages.

Using Profile Extensions

Suppose you have a standard "Customer Card" page, but for your "Sales Manager" profile, you want to hide the "Credit Limit" field because they should not be editing that information. Instead of modifying the base "Customer Card" page (which would affect everyone), you create a profile extension.

profileextension SalesManagerExtension extends SalesManager
{
    pageextension "Customer Card Ext"
    {
        // This allows you to apply page-specific changes 
        // that only apply to this profile.
    }
}

Wait—it is important to clarify that profileextension objects are primarily used to define custom actions or modify page layouts specifically for the profile's users. You can influence the behavior of the UI by creating specific page extensions that are conditionally triggered or by modifying the Role Center layout itself.

Best Practices for Role Center Layouts

When building the Role Center page, follow these design principles to ensure a high-quality user experience:

  1. Prioritize Cues: Place the most critical tasks (e.g., "Orders to Ship Today") in the top-level Cue group.
  2. Logical Navigation: Group menu items into logical buckets like "Customers," "Sales," and "Reports."
  3. Minimize Clutter: Do not pack every possible page into the navigation pane. Only include pages that the user needs daily.
  4. Performance: Avoid putting heavy, resource-intensive charts directly on the Role Center page, as this will slow down the initial login experience.

Not read yet

Implementing Onboarding: The Role of Profiles

Onboarding is the process of guiding a new user through the application to ensure they understand how to use it. In Business Central, this is often handled through "Tours" and "Teaching Tips." Profiles play a key role here because the onboarding experience should be tailored to the user's role.

Creating a Guided Tour

You can associate a tour with a Profile so that when a user logs in for the first time, they receive a walkthrough of their specific Role Center. This is implemented via the TableData or Page metadata, but the trigger is often managed through the Profile settings or system configurations.

Tip: Use the "User Tours" functionality in the Business Central client to record your walkthroughs. Once recorded, you can export these as JSON and include them in your AL project to ensure that every user assigned to a specific profile gets the same onboarding experience.

Teaching Tips for Contextual Help

Teaching tips are small, pop-up bubbles that point to specific UI elements. You can add these to your pages to explain what a button does or why a field is important. By combining these tips with your Profile customization, you ensure that the guidance provided is relevant to the user's specific workflow.

Not read yet

Industry Standards and Best Practices

To maintain a professional and scalable codebase, you should adhere to several industry-standard practices when developing Profiles.

1. Naming Conventions

Always use a consistent naming convention for your profiles. For example, prefix your profile names with your company or module name to avoid conflicts with standard Microsoft profiles or other extensions. If you are building a module for "Inventory Management," name your profile InvMgr_InventoryManager.

2. Versioning and Updates

When you update a Profile, keep in mind that users may already have personalized their workspace. If you remove a field from a page that a user has pinned to their Role Center, it may cause errors or visual artifacts. Always communicate changes in the UI layout to the end-users.

3. Use of Cues and KPIs

Cues should always be backed by a standard table (usually a Cue table type). This ensures that the data calculation is efficient and that the system can properly handle the "drill-down" functionality. If you write custom code to calculate cues, ensure it is optimized for high-volume data.

4. Avoiding "Hard-Coding"

Avoid hard-coding permissions or security filters directly into the Profile. Security should always be handled through Permission Sets and Permission Groups. The Profile is for the UI experience, not for data access control.

Callout: The Separation of Concerns Remember that the Profile defines what the user sees (UI), while Permission Sets define what the user can do (data access). Never attempt to use a Profile to hide sensitive data for security purposes, as a savvy user can easily bypass the UI. Always use Security Filters for data protection.

Not read yet

Common Pitfalls and How to Avoid Them

Even experienced developers can run into issues when customizing the UI. Here are some common mistakes and how to steer clear of them.

Over-Customizing the UI

A common mistake is trying to "fix" every single page in the system for a specific profile. This leads to a massive amount of code to maintain. Instead, focus on customizing the Role Center and the most frequently used documents (e.g., Sales Order, Customer Card). Let the standard system behavior handle the rest of the application.

Ignoring Mobile Responsiveness

Remember that many users will access Business Central via a tablet or phone. When designing your Role Center, keep in mind that the layout will be compressed on smaller screens. Test your Role Center layout on different device types to ensure that your Cues and navigation aren't breaking or becoming unusable.

Lack of Documentation

Because Profiles are often "invisible" to the end user (they just see the result), developers sometimes forget to document the intended purpose of each profile. Use the ProfileDescription property religiously. If you have a complex setup, keep a separate document or README in your repository explaining the design choices made for each profile.

Testing with Only One User

Always test your profiles with a user account that has the same permission level as the target audience. Sometimes, a profile will look perfect to a "Super User," but when a standard user logs in, they might see broken links or missing data because they lack the permissions to view the underlying objects.

Not read yet

Step-by-Step: Creating a Custom Role-Based Experience

Let's walk through the process of creating a custom profile for a "Warehouse Clerk."

Step 1: Define the Role Center Page

First, create a new page object of type RoleCenter.

page 50100 "Warehouse Clerk RC"
{
    Caption = 'Warehouse Clerk';
    PageType = RoleCenter;

    layout
    {
        area(RoleCenter)
        {
            group(Control1)
            {
                part(WarehouseCues; "Warehouse Cues") { }
            }
        }
    }
}

Step 2: Define the Profile

Next, link this page to a new Profile object.

profile WarehouseClerk
{
    Caption = 'Warehouse Clerk';
    RoleCenter = "Warehouse Clerk RC";
    ProfileDescription = 'Access for managing warehouse receipts and shipments.';
}

Step 3: Customize the UI with a Page Extension

Create a page extension to hide unnecessary fields on the "Item Card" specifically for this profile.

pageextension 50101 "Item Card Ext" extends "Item Card"
{
    layout
    {
        modify("Unit Cost")
        {
            Visible = false; // Hide cost info from warehouse staff
        }
    }
}

Step 4: Verification

Log in as a user assigned to the "Warehouse Clerk" profile. Verify that the Role Center displays the expected cues and that the "Unit Cost" field is hidden on the Item Card. If the field is still visible, ensure that your extension is correctly published and that the user is actually assigned to the new profile in the "Profiles" list in Business Central.

Not read yet

Comparison Table: Profile Features

Feature Description Importance
RoleCenter The primary dashboard page. High (Defines the workspace)
Profile Description Internal notes for developers. Medium (Documentation)
Enabled Flag Toggles profile availability. High (Control)
Role Center Actions Custom buttons in the navigation. High (Workflow efficiency)
Teaching Tips In-app guidance bubbles. Medium (Onboarding)

Managing Profiles via the Web Client

While you define the structure in AL, you can also perform "Configuration" directly in the Business Central web client. This is often the preferred way to fine-tune a profile's layout without redeploying code.

  1. Log in as an administrator.
  2. Navigate to the "Profiles" page.
  3. Select the profile you want to configure.
  4. Click "Manage" and then "Customize Pages."
  5. This opens the browser in a special design mode. Make your changes (e.g., move a field, hide a menu).
  6. When you finish, click "Done." These changes are now saved as a configuration for that profile.

Warning: Be cautious with client-side customization. If you make too many changes via the browser, it becomes difficult to track what has been modified. Always try to keep your core UI definitions in AL code for better source control, and use the browser only for minor tweaks or testing.

Not read yet

Handling Multi-Company Environments

In many Business Central setups, a single tenant contains multiple companies. Profiles are global objects, meaning they exist across the entire environment. If you create a "Warehouse Clerk" profile, it will be available in all companies within that tenant.

If you have a scenario where the "Warehouse Clerk" in Company A needs a different UI than the "Warehouse Clerk" in Company B, you have two options:

  1. Separate Profiles: Create WarehouseClerk_CompanyA and WarehouseClerk_CompanyB.
  2. Conditional Logic: Use AL code to dynamically hide/show fields or actions based on the current company (CompanyName function).

Generally, the first option is cleaner and easier to manage, as it avoids complex if-then-else logic inside your UI code.

Troubleshooting Common UI Issues

When your profiles aren't behaving as expected, check these three areas:

  1. Permissions: Does the user have the "D365 BASIC" or equivalent permission set? If the user doesn't have permission to the page object, the Role Center will not render correctly.
  2. Profile Assignment: Sometimes the user is still assigned to an old profile. Go to the "User Personalization" page and verify the "Profile ID" assigned to the user.
  3. Extension Conflicts: If you have multiple extensions modifying the same page, the order of execution can matter. Use the ApplicationArea property consistently to ensure that fields are not hidden by mistake.

Not read yet

Key Takeaways for AL Developers

To summarize the essential aspects of creating and managing profiles in Business Central:

  • Profiles are Blueprints: They are the foundation of the user experience, linking a specific persona to a Role Center and a set of UI configurations.
  • Decouple Security from UI: Always remember that Profiles are for layout and workflow, not for data security. Use Permission Sets for restricting access to data.
  • Prioritize the User: The goal of a custom profile is to make the user's job easier. Focus on simplifying the navigation and highlighting the most relevant data.
  • Use Code for Structure: While browser-based customization is convenient, keeping your UI definitions in AL code ensures better version control, easier deployment, and a cleaner audit trail.
  • Test Thoroughly: Always test your profiles with different user roles and device types to ensure a consistent and functional experience across the board.
  • Documentation is Key: Use the ProfileDescription property and maintain external documentation to help your team understand the intent behind each profile.
  • Iterate Responsibly: Changes to profiles affect real workflows. Communicate changes to your users and provide the necessary onboarding or training materials to ensure they are comfortable with the new interface.

By following these principles, you will be able to create highly effective, role-specific interfaces that improve user productivity and make your Business Central implementation a success. Remember that a great UI is one that the user barely notices because it provides exactly what they need, exactly when they need it. Keep your designs clean, your code organized, and your user's workflow at the center of your development process.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.