community postAdministration & Setupcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: How to check whether the current user has only the Microsoft 365 Plan in AL

Detect whether a Business Central user has only a Microsoft 365 license by querying the Users In Plans table and checking the Plan ID. This helps apply custom logic or UI changes based on license type, useful since Microsoft 365 plan users can access BC in Teams but encounter errors when accessing directly.

post Dynamics 365 Lab

Yun Zhu · 2025-05-28 · 710 words · about 3 min

"To determine whether the current user is accessing Business Central using only a Microsoft 365 license, the following code snippet can be used"

Key points

  • Users with only Microsoft 365 licenses can access Business Central through Microsoft Teams but not directly
  • Use the Users In Plans query filtered by User Security ID to determine license type
  • Check if the user’s Plan ID matches the Microsoft 365 Plan ID from the Plan Ids codeunit
  • The example page extension demonstrates how to show different messages based on license type
  • Licensing is important for cost optimization and data governance in multi-license scenarios

Quotes

  • “To determine whether the current user is accessing Business Central using only a Microsoft 365 license, the following code snippet can be used” (Establishes the core purpose of the technical solution for license type detection)
  • “Users are entitled to access Business Central data in Microsoft Teams.” (Clarifies the key difference between Microsoft 365 plan users’ access capabilities across different interfaces)
  • “Meet licensing budget targets by assigning licenses that progressively match employee needs” (Explains the business value of distinguishing between license types for cost management)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

No source states these links: they share an object, a model read them, or a person found the same subject.

Context

  • Features: Microsoft 365 plan user detection, License validation, Teams access, User plan identification, Custom logic based on licensing
  • Versions: BC21, 2022 wave 2

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.