Hi, Readers.
Business Central users are assigned a Dynamics 365 Business Central license that allows them to view, modify and act on their business data from any user interface. For all other employees across the organization that only need to occasionally view data, starting with Business Central 2022 wave 2 (BC21), Business Central offers access through Microsoft 365. More details:
- Info: Access Business Central with your Microsoft 365 license – regardless of whether users have a Business Central license (Collaboration capabilities for Dynamics 365)
- Business Central 2022 wave 2 (BC21): Access Business Central with your Microsoft 365 license (Detail Test)


PS:
1. Users are entitled to access Business Central data in Microsoft Teams. The following table summarizes which of the different methods of accessing the Business Central service are allowed with this license.

2. Why enable access with Microsoft 365 licenses:
- Unlock master data that every employee across the organization should have access to.
- Empower departments that don’t run on Business Central to self-serve, by accessing key data needed to successfully perform their tasks, eliminating the need for continually requesting data from others.
- Increase collaboration efficacy so that tasks and projects that span across departments complete on time, by eliminating the friction that is typically associated with access denied errors due to licensing.
- Increase team performance so that people can make data-driven decisions that are inclusive of everyone in the group, even if they don’t work in Business Central.
- Meet licensing budget targets by assigning licenses that progressively match employee needs, with Microsoft 365 licenses for read-only access, Dynamics 365 Business Central Team Member licenses for limited write access, and Dynamics 365 Business Central Essentials or Premium for full write access.
- Improve data security by reducing the need for pasting screen snippets of business data outside of data governance boundaries.
For example, the following user only has a Microsoft 365 license, but no BC.

When accessing BC directly, the following error will be prompted.
Sorry, we couldn’t sign you in
Your account has been authenticated, but there is no valid license. When accessing Business Central with a Microsoft 365 license, the license must originate from one of the supported Microsoft 365 plans. Please contact your system administrator to get a valid license assigned to you. For more information, see https://go.microsoft.com/fwlink/?linkid=2209653.

However, the user can access BC in Teams, which does not require a BC license.

So can we check whether the current user has only the Microsoft 365 Plan in AL? Perhaps the customer wants to add some different logic, or hide some fields based on the license type. Yes, Microsoft provides a standard example. More details: Get relevant session and environment details for Teams integration
To determine whether the current user is accessing Business Central using only a Microsoft 365 license, the following code snippet can be used:

PS: If you are interested in the internal logic, you can check out the following posts
- Dynamics 365 Business Central: How to view all licensed users (Users in Plans)
- Dynamics 365 Business Central: All service plan identifiers (Plan Ids)
Here is a simple example:

Very simple.


Source code:
pageextension 50113 ItemListExt extends "Item List"
{
trigger OnOpenPage()
begin
if IsM365PlanUserOnly() then
Message('You are a Microsoft 365 Plan user only.')
else
Message('You have other plans in addition to Microsoft 365 Plan.');
end;
// checks whether the current user has only the Microsoft 365 Plan
procedure IsM365PlanUserOnly(): Boolean
var
PlanIds: Codeunit "Plan Ids";
UsersInPlans: Query "Users In Plans";
IsM365PlanUser: Boolean;
DoesUserHaveOtherPlans: Boolean;
begin
UsersInPlans.SetFilter(User_Security_ID, UserSecurityId());
if not UsersInPlans.Open() then
exit(false);
while UsersInPlans.Read() do
if (UsersInPlans.Plan_ID = PlanIds.GetMicrosoft365PlanId()) then
IsM365PlanUser := true
else
DoesUserHaveOtherPlans := true;
exit(IsM365PlanUser and (not DoesUserHaveOtherPlans));
end;
}
In addition, if you just want to distinguish the client type, you can use ClientType Option Type, this can also distinguish between Teams client and Web client.
More details: Dynamics 365 Business Central: How to get the client type that is running in the current session via AL code
Give it a try!!!😁
2. Dynamics 365 Business Central: How to check if a user is Delegated Admin via AL
END
Hope this will help.
Thanks for reading.
ZHU
コメント