Dynamics 365 Business Central: How to view all licensed users (Users in Plans)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about how to view all licensed users in Business Central.

As you might know, when we add a new user in the cloud (SaaS), the +New action on the Users page is grayed out.

To add a new user to Business Central, you need to sign into Microsoft 365 Admin Center. Choose Users -> Active users -> Add a user.

Enter basic information.

Then assign a license for Business Central to the user.

After you add users or change user information in the Microsoft 365 Admin Center, you can quickly import the user information to Business Central. The import includes license assignments.

  1. Sign in to Business Central using an administrator account.
  2. Choose the Lightbulb that opens the Tell Me feature. icon, enter Users, and then choose the related link.
  3. Choose Update Users from Microsoft 365.

The user will be added to Business Central.

Okay, this is not a problem, it’s just a different way to add users. Next, what should we do when we want to clean up users from BC?

When you try to delete a user in BC, you will see the following message.

You cannot add or delete users on this page. Administrators can manage users in the Microsoft 365 admin center.

We need to return to Microsoft 365 admin center to unassign Business Central licenses from the user.

  1. In the admin center, go to the Users > Active users page.
  2. Select the row of the user that you want to unassign a license for.
  3. In the right pane, select Licenses and Apps.
  4. Expand the Licenses section, clear the boxes for the licenses that you want to unassign, then select Save changes.

And in Business Central, we can remove a user’s access to Business Central. (All references to the user are kept. However, the user can’t sign in and active sessions for the user are stopped)

  1. Choose the Lightbulb that opens the Tell Me feature. icon, enter Users, and then choose the related link.
  2. Open the User Card page for the relevant user, and then, in the Status field, select Disabled.

To permanently disable a user, go to your Microsoft 365 admin center. Disabling the user in Business Central will only be effective until the next user synchonization with Microsoft 365.

PS: To give the user access again, set the Status field to Enabled.

The user will not be able to sign in unless you change the state to Enabled. Are you sure that you want to close the page?

Therefore, there will be situations in the system where the user does not have a license but is enabled, or the user has a license but is disabled.

For the list of user status, we can easily use Users (9800, List).

But, how to view all licensed users in Business Central???

On the Users page and User Card page, we can find the license types displayed in User Plans FactBox (9826, ListPart), and the source table is User Plan (9005).

If you open the User Plans FactBox (9826, ListPart) directly, you cannot see any user information.

And, User Plan (9005) table cannot be opened directly.

You do not have the following permissions on TableData User Plan: Read.

The data in the table cannot be exported either using Configuration Package.

If you check the source code of User Plan (9005) table, you can find the Access property of the table is Internal.
Access = Internal;

ValueDescription
PublicThe object can be accessed by any other code in the same module and in other modules that references it.
InternalThe object can be accessed only by code in the same module, but not from another module.

Microsoft does not allow users to access the User Plan table, perhaps for some security reasons, but fortunately has prepared another way to access the data in the User Plan table.

query 774 “Users in Plans”:

So, you can force Business Central to run the query by adding the ?query=774 parameter to the URL, such as in the following example: 
https://businesscentral.dynamics.com/d8f36038-1f93-4543-affc-5dc92b6ee871/Sandbox202?query=774

Then you can find Plan Name (License) and User state in the query, very convenient.

You can filter Plan Name to export a list of licensed users.

PS:
1. You can find all license list on the License Configuration page (Set Default User Groups and Default Permission Sets for the license type)

2. We can display the user plan list on a new list page via customization.

Source Code:

table 50123 UserPlan
{
    TableType = Temporary;
    DataClassification = CustomerContent;
    fields
    {
        field(1; "User Security ID"; Guid)
        {
            Caption = 'User Security ID';
            DataClassification = CustomerContent;
        }
        field(2; "Plan ID"; Guid)
        {
            Caption = 'Plan ID';
            DataClassification = CustomerContent;
        }
        field(10; "User Name"; Code[50])
        {
            Caption = 'User Name';
            DataClassification = CustomerContent;
        }
        field(11; "Plan Name"; Text[50])
        {
            Caption = 'Plan Name';
            DataClassification = CustomerContent;
        }
        field(12; State; Option)
        {
            Caption = 'User State';
            OptionCaption = 'Enabled,Disabled';
            OptionMembers = Enabled,Disabled;
            DataClassification = CustomerContent;
        }
    }
    keys
    {
        key(Key1; "Plan ID", "User Security ID")
        {
            Clustered = true;
        }
    }
}
page 50123 UserPlans
{
    Caption = 'User Plans';
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = UserPlan;
    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field("User Security ID"; Rec."User Security ID")
                {
                    ToolTip = 'Specifies the value of the User Security ID field';
                    ApplicationArea = All;
                }
                field("User Name"; Rec."User Name")
                {
                    ToolTip = 'Specifies the value of the User Name field';
                    ApplicationArea = All;
                }
                field("Plan ID"; Rec."Plan ID")
                {
                    ToolTip = 'Specifies the value of the Plan ID field';
                    ApplicationArea = All;
                }
                field("Plan Name"; Rec."Plan Name")
                {
                    ToolTip = 'Specifies the value of the Plan Name field';
                    ApplicationArea = All;
                }
                field(State; Rec.State)
                {
                    ToolTip = 'Specifies the value of the User State field';
                    ApplicationArea = All;
                }
            }
        }
    }
    trigger OnOpenPage()
    var
        UsersInPlans: Query "Users in Plans";
    begin
        if UsersInPlans.Open() then begin
            while UsersInPlans.Read() do begin
                Rec.Init();
                Rec."User Security ID" := UsersInPlans.User_Security_ID;
                Rec."User Name" := UsersInPlans.User_Name;
                Rec."Plan ID" := UsersInPlans.Plan_ID;
                Rec."Plan Name" := UsersInPlans.Plan_Name;
                Rec.State := UsersInPlans.User_State;
                Rec.Insert();
            end;
            UsersInPlans.Close();
            Rec.FindFirst();
        end;
    end;
}

3. In additional to viewing licensed users in Business Central, you can also find this list in the Microsoft 365 admin center.

First log in to Microsoft 365 admin center. Choose Billing -> Licenses, or search for Licenses, and then choose the related link.

Click the license name, for example, Dynamics 365 Business Central for IWs (trial license)

Then you can find the licensed users.

You can also choose Export users to export all licensed users.

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL