Hi, Readers.
A few days ago we discussed how to check whether the current environment (Tenant) is a trial environment via AL. Then I got a question, “Do you also maybe know how to check whether the environment is in a Partner Demo AAD tenant?”. The Partner Demo AAD tenant here refers to the Partner Sandbox.
As a partner, you can buy the Dynamics 365 Business Central Partner Sandbox license. You’ll need a valid Microsoft Partner Network (MPN) ID. You must also have at least five employees who will use the partner sandboxes that you create using this license. This offer was made available in February 2022 to support partners that need non-production environments to learn, test, and deliver end-to-end customer demos with their solutions. The Partner Sandbox license gives access to Business Central Premium functionality.
The environments that you acquire through the Dynamics 365 Business Central Partner Sandbox license are strictly meant for use only on the partner’s tenant. You are not allowed to use this license in a customer tenant, nor in a production environment.
More details: New Partner Sandbox Environments: Use the Partner Sandbox license for an Microsoft 365 account that does not currently have a Business Central license. This gets you 1 production environment + 3 sandboxes.
So the Partner Sandbox environment is not a trial environment, we cannot use codeunit 2300 “Tenant License State” to do this.
All methods in this codeunit:
Is there any other way?
Yes, we can determine this by the Business Central license type.
In the License Configuration page, you can find all currently supported license types. More details: License Configuration page (Set Default User Groups and Default Permission Sets for the license type) and Configure permissions based on licenses
In Version: W1 22.5 (Platform 22.0.60247.0 + Application 22.5.59966.60134):
License |
---|
Delegated Admin agent – Partner |
Delegated Helpdesk agent – Partner |
Internal Administrator |
Dynamics 365 BC Premium Partner Sandbox |
Dynamics 365 Business Central Essential – Embedded |
Dynamics 365 Business Central Team Member |
Dynamics 365 Business Central Premium |
D365 Business Central Basic Financials |
Dynamics 365 Business Central Essential |
D365 Business Central Infrastructure |
Microsoft Dynamics 365 – Accountant Hub |
Dynamics 365 Business Central Device – Embedded |
D365 Business Central Team Member – Embedded |
Dynamics 365 Business Central External Accountant |
Dynamics 365 Business Central Premium – Embedded |
Dynamics 365 Business Central Device – Embedded |
Dynamics 365 Business Central for IWs |
Microsoft 365 |
Let’s look at a few examples.
Paid environment (Essential): Dynamics 365 Business Central Essential
In Microsoft 365 admin center:
Trial environment: Dynamics 365 Business Central for IWs
In Microsoft 365 admin center:
Partner Sandbox: Dynamics 365 BC Premium Partner Sandbox
In Microsoft 365 admin center:
Okay, we have discussed in How to get a user’s license type from AL, about how to use query 774 “Users in Plans” to get the user’s license type.
PS: 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/Sandbox?query=774
For example,
We can do a similar process. The following is an example of “Dynamics 365 Business Central for IWs”, you could replace the filter with “Dynamics 365 BC Premium Partner Sandbox”.
Source Code:
pageextension 50123 MyExtension extends "Customer List"
{
trigger OnOpenPage()
var
UsersInPlans: Query "Users in Plans";
i: Integer;
begin
i := 0;
UsersInPlans.SetFilter(UsersInPlans.Plan_Name, 'Dynamics 365 Business Central for IWs');
UsersInPlans.Open();
while UsersInPlans.Read() do begin
i += 1;
end;
if i > 0 then
Message('This is a trial environment.\There are ''%1'' users in the ''%2'' plan.', i, 'Dynamics 365 Business Central for IWs');
end;
}
You can also use this way to check whether an environment is Essential or Premium, but personally do not recommend.
PS: Different licenses for different production environments (Essentials and Premium in separate environments, on the same tenant)
Finally,, please note that there is a prerequisite here, that is, at least one user in the system must have been assigned a Business Central license.
Give it a try!!!😁
PS: The Access property of table 9017 “Plan Configuration” is set to Internal, we cannot use the Id to get the Plan Name. More details: Can we access the standard internal table/field (Access Property = Internal) via AL???
END
Hope this will help.
Thanks for your reading.
ZHU
コメント