Business Central

Tuesday, 14 January 2020

Managing Sandbox and Production Environments

In this blog we will discuss about more detailed overview of Business Central Admin Center.
Topics Covered-

  • How to view details of an environment
  • Types of Environments
  • How to Create Production and Sandbox Environments
  • Precautions for sandbox environments with production data
  • Selecting a version for a new sandbox environment


So let's see the considerations we have in our mind when choosing between creating a Sandbox or Production environment.

The Environments tab of the Business Central administration center provides you with an overview of the Business Central production and sandbox environments for the tenant, and you can manage updates for each environment as shown in below image.



Viewing details for an environment

In the list of environments, you can open a page with more details for an environment by choosing the link in the Name column of the list for the environment.



Types of environments
You can create environments of different types. Which type of environment to choose depends on what you need it for.

Production environments

  • Production environments are meant to be precisely that: Environments that a business can run their daily business in Business Central in, deployed on performance tiers in Azure with a guaranteed high level of availability and support.
  • Production environments are backed up automatically and frequently to help protect business data. For more information, see How often are production databases backed up?.
  • You can create additional production environments for training or performance testing, for example. However, for training purposes, in many cases organizations will prefer to create a sandbox environment with production data. You can also create additional production environments to support offices in different countries.
  • You can have a maximum of three production environments for each Business Central tenant.


Sandbox environments

  • Sandbox environments are meant to be precisely that: Environments that you can play around with, use as a testbed for development, and delete at will. You can deploy apps straight from Visual Studio Code to a sandbox environment, and you can attach a debugging session to a sandbox.
  • You can also safely use sandboxes because it's a safe environment to experiment with. If anything goes wrong, you just delete the sandbox and start over.
  • The automatic backup that applies to production environments does not apply to sandbox environments. If you want to export data from a sandbox environment, you can use Excel or RapidStart, but you cannot request a database export.
  • You can create a sandbox environment that includes data from your production environment for debugging purposes, for example. But if you want to run performance tests, or similar benchmarking, the sandbox is not reliable enough for that purpose. This is because sandboxes run in a different performance tier on Azure than production environments. Instead, create a dedicated environment based on the Production environment type - this gives you the exact experience and performance that users will experience in the actual production environment.
  • Sandbox environments are handy for certain types of development scenarios because the debugging endpoint is open by default. This means that you can attach Visual Studio Code to a running system and debug through running code. It also allows you to publish directly to the environment from Code.
  • You can have a maximum of three sandbox environments for each Business Central tenant.

How to Create a new Production Environment

To create a production environment:
  1. On the Environments tab of the Business Central administration center, choose the New action on the action ribbon.
  2. In the Create Environment pane, in the Environment Type list, choose Production.
  3. In the Country list, select the country for the environment. The specified country determines the localization for the environment, as well as the Azure region in which the environment is created and stored.
  4. Select Create.
When the new production environment is created, it will be based on the latest production version of Business Central.

How to Create a new Sandbox Environment

A sandbox environment is a non-production instance of Business Central. Isolated from production, a sandbox environment is the place to safely explore, learn, demo, develop, and test the service without the risk of affecting the data and settings of your production environment.

Make sure that you understand the limitations of a sandbox before you create a new sandbox environment

Each Business Central tenant is limited to three sandbox environments.

How to create a new sandbox environment:

  1. On the Environments tab of the Business Central administration center, choose the New action on the action ribbon.
  2. In the Create Environment pane, specify a name for the new environment.
  3. In the Create Environment pane, in the Environment Type list, choose Sandbox.
  4. Specify if you want the sandbox environment to contain a copy of another environment. If you choose this option, you must specify which environment to copy.
  5. When you create a sandbox environment as a copy of another environment, the new environment is created on the same application version as the environment that you are copying. The new environment will also contain all per-tenant extensions and AppSource extensions that are installed and published in the original environment that is being copied.
  6. In the Country list, select the country for the environment. The specified country determines the localization for the environment, as well as the Azure region in which the environment is created and stored.
  7. Choose the relevant application version for the new sandbox environment from the Version list if more than one version is available.
  8. Select Create
  9. The sandbox environment will not be accessible until the State shows Active.
A single, default sandbox environment can also be created in the Business Central application. For more information.

To delete a sandbox environment, choose the environment on the Environments tab of the Business Central administration center, and then choose Delete on the action ribbon.

Precautions to be taken for sandbox environments with production data-

If a sandbox is created with a copy of a production environment, a number of precautions are taken for that sandbox:
  • The job queue is automatically stopped
  • Any base application integration settings are cleared
  • Outbound HTTP calls from extensions are blocked by default and must be approved for each extension
  • Any General Data Protection Regulation (GDPR) action must be handled separately and repeated for the sandbox. There is no synchronization with the production environment after the sandbox has been created
To enable outbound HTTP calls, go to the Extension Management page in Business Central, and choose Configure. Then, on the Extension Settings page, make sure that Allow HttpClient Requests is selected. This setting must be enabled for each extension.


Selecting a version for a new sandbox environment

  • If you choose to create a sandbox that is not a copy of an existing environment, you must specify an application version for the new environment. 
  • The version list will show the latest production version, which is the version used for new production environments.
  • The version list may also have one or more preview versions. Preview versions are early release candidates of upcoming releases of Business Central that are made available specifically for sandbox environments. 
  • This gives you access to review new functionality, validate extension compatibility, and other general testing of the upcoming release.
  • When you create a sandbox environment on a preview version, the environment will automatically be updated to new preview versions when they become available. However, the environment will not be updated to the production version. 
  • Once a sandbox environment is on a preview version, it must stay on a preview version until it is deleted. 
  • The environment can also be deleted if an update between preview versions fails. We recommend that preview versions are used only for temporary testing of an upcoming release.

Role Explorer in Business Central Wave 2

You have heard about Role center how it works but let's dig a new feature in Business Central called Role Explorer and will see how it works.

Shift+F12 is a keyboard shortcut in MSDyn365BC that brings the different areas of Business Central closer to you. This overview feature, called Role Explorer, can also be accessed from the menu icon in the navigation bar as shown in the below image.


You can get an overview of all the business features that are available for your role, and for other roles if you go a step further.

In the following documentation, this feature overview is referred to as the role explorer.

Each element on the role explorer is an action that opens a page. Accordingly, you can also use the role explorer as a means to navigate in Business Central.

You can open the role explorer from the Role Center and all list pages and from the Tell Me  window.


  1. On your Role Center or any list page, choose the Menu button button to the right of the navigation bar, or press Shift+F12.
  2. In the Tell Me window, choose the exploring action at the bottom.
  3. To get an overview of business feature that are available for all other roles, in addition to your own, choose the Explore all action on the page that presents the role explorer.
  4. Only Role Center actions for profiles where the Show in Role Explorer check box is selected will appear on the extended version of the role explorer (shown with the Explore all action)



How to expand/collapse nodes on the role explorer?

The actions that open pages are organized under nodes named after the features or application areas. Each node can be collapsed or expanded individually and you can collapse/expand all nodes together.


  • To expand/collapse a node, choose the node. This applies to top-level nodes and sub nodes.
  • To expand/collapse all top-level nodes on the page, choose the Expand or Collapse action in the top-right corner.
  • To expand/collapse a top-level node and all sub nodes under it, press the Ctrl+Shift keys while you choose the Expand or Collapse action in the top-right corner.

Identify the company by a badge (Business Central Wave 2)

Do you have multiple tabs or pop-out windows open that make it hard to identify one company you work with from another?
Set up the colorful company badge in MSDyn365BC to add more clarity to your workday.

Users can now use the Company Badge functionality to identify one company they work with from another. This is helpful when users have multiple tabs or pop-out windows open or when they are working with multiple companies on a daily basis.

To set it up, go to the Company Information page (for example, by typing "badge" in the Tell Me window) and choose your badge color and label.


Wednesday, 8 January 2020

An overview of CSP, Business Central Admin Center, Multiple production environments and its use

An overview of CSP, Business Central Admin Center, ability to create multiple production environments for each Azure Active Directory tenant in Business Central Wave 2.

Cloud Service Provider(is a company that offers some component of cloud computing, typically infrastructure as a service (IaaS), software as a service (SaaS) or platform as a service (PaaS) to other businesses or individuals.

CSP enables partners to access a portfolio of Microsoft cloud services to be sold.
Within this program, there are tools for managing and supporting these cloud
services.

One of these online services is Dynamics 365 Business Central.

In the SaaS proposition, it is only through the CSP partners or their resellers that a
potential customer could purchase licenses for Dynamics 365 Business Central and
convert the trial license into a pay-per-use license or start by directly paying the
monthly fee for the users.

In every CSP, a partner or reseller is technically represented by a unique tenant
record in the Azure Active Directory (AAD). AAD is a multi-tenant authentication
service that offers identity and access capabilities for applications running in
Microsoft Azure and Microsoft on-premises environments.

Within this specific AAD tenant record, a partner can define a different type or class
of users (often called supporting agents) that are mainly categorized into two
different groups (so-called agent groups): Admin and Helpdesk groups.

Like partners, customers also have their own AAD tenant unique record. When
subscribing to an Essential or Premium plan within a Dynamics 365 Business Central
tenant, every customer gives consent for a special trusted relationship between the
CSP partner and the customer AAD tenants.

In the customer, AAD tenants, user, role, and subscription entities are defined
and managed. Roles are assigned to users by the customers and these roles reflect
their capabilities in the products that they subscribe to. Subscribing to an online
product such as Dynamics 365 Business Central in the customer AAD tenant requires
the further important step of the CSP partner assigning the specific online product
license to the users.

These tasks are performed through the Business Central Admin portal.
This portal can be accessed directly by the customer or the CSP partner. The CSP partner may
also have access via the Partner Center portal:

1. With the Partner Center portal, there are several ways to browse to the Dynamics 365 Business Central Admin Center portal. One of these is from the Service Management tab. The Service Management tab contains links to various admin portals related to a specific customer AAD tenant, such as Exchange or Office 365. It also displays the service health status for products that the portals or administrator consoles refer to, such as Exchange Online, Identity Service, and Dynamics 365 Business Central.

2. By clicking on the Dynamics 365 Business Central link, the partner will be redirected straight to the Dynamics 365 Business Central Admin Center portal. Back in the Partner Center portal, the CSP partner is also able to check the customer's order history and see which subscriptions they belong
to. It is also possible to select the Dynamics 365 Business Central billing frequency – such as monthly or once per year – and subscribes to different online services on behalf of that customer.

3. The subscriptions are divided per offering type (level). As an example, within Dynamics 365 Business Central, it is possible to choose the Essential or the Premium plan.

4. In the Users and licenses section, the CSP partner can add users manually or upload many of them from a file. For every user, a different service license can be assigned.

5. Once a license has been assigned, the user can start working with Dynamics 365 Business Central and will have the app listed on their home page at home.dynamics.com. Clicking on the Dynamics 365 Business Central icon redirects the user to their first login, and they can start working immediately in the production tenant. You may notice that the URL definition benefits from an easy to identify fixed client endpoint and customer tenant, and its Dynamics 365 Business Central Admin portal should look like this:

Customer tenant: https://businesscentral.dynamics. com/<GUID>

Customer tenant admin portal: https://businesscentral.dynamics.com/<GUID>/admin

GUID identifies the same customer environment that you came from in the Partner Center portal.

As most of them know until the release of Business Central Wave 2 we had no option of selecting multiple production environments in Azure. Only we'd option of selection multiple sandbox(stage environments).
Since the Fall 2019 update(Business Central Wave2 a new feature allowed us to select even multiple production environments, so if you have multiple production environments, when you click on the Dynamics 365 Business Central icon on the home page (home.dynamics.com), you will be
prompted to select which environment name to choose. The environment endpoint should look like https:/ /businesscentral.dynamics.com/<EnvironmentName>.

So, who can access the Dynamics 365 Business Central Admin Center portal? The answer is as follows:
CSP Partner Admin and Helpdesk agents who have an active entitled
relationship with the customer tenant The customer's AAD Global Administrator

Dynamics 365 Business Central licensed users won't be able to access the administration portal. There is no relationship between the product license and Dynamics 365 Business Central Admin Center portal access.

The customer's AAD tenant Global Administrator can sign in, and partner AAD tenant Administrators and Helpdesk users can access as a Delegated Admin. Delegated Admins can perform elevated tasks as Partner, but they do not have the same rights that the customer's Global Administrator has. In short, Delegated Admins are not Global Administrators of the tenant.

Why and When do we need to use Integer Dataitems in Report of D365 BC (Dynamics NAV)

I can call this blog as my researched blog post.

This blog is not completely based on my writing but have referred to various forums and brought the information of all the discussion forums related to Integer virtual table in one common post.

I believe this blog will give you every information about Integer Virtual Table and why and when do we use it in Reports.


What is Integer table?

  • Integer is a virtual table which doesn't have it's physical existence, its computed at run-time and it's not saved in any physical storage. Once the processing of Integer virtual table is completed it just clears it's records. 
  • Integer table has 1 field called Number of datatype integer and we cannot modify it as it is a virtual table.  We'll be not able to modify or delete the table. We can only read the information of Integer table as it is a virtual table.
We normally use Integer table for temporary tables when we use it in reports -
Temporary datasets are a widely used feature across the Dynamics NAV/Business Central  application. 

Examples of potential uses of temporary datasets include reports, pages (e.g. the Navigate page) and queries
Temporary datasets can be represented by a so-called “buffer” table which is loaded with values and then used for further processing. Of course, the end-user will not see the difference in the data representation, be from an existing table in the database, or from a temporary dataset holding the values from multiple tables.

The advantage of using Integer as a temporary table in report is that
  • All the interaction with a temporary table occurs on Microsoft Dynamics NAV/Business Central Server. This reduces the load on both the network and the SQL database server. They cause less traffic load on the server and database engine
  • They speed up application performance (page load and report generation times)
  • They allow for concurrent data usage (i.e. multiple users using the same dataset will not encounter locks)

Why do we need Integer Dataitems in reports?

Integer dataitem is used for several purposes:

1) to print details of buffer tables(temp tables) - and with this buffer tables you almost can do all kinds of reports including dynamic sorting without adding extra keys.
2) to avoid blank page at the end
3) to print sections (body/header/footer) at a place as you wish
4) to print multiple copies

1. Integer table data items are used to print details of temporary tables in reports

The use of temporary tables in report depends a lot of your specific requirements but they are
usually used to convert records from one table to another or inserting additional records to print. When I mean convert records it means to copy/Insert records from one table to another table based on some conditions at runtime.

Converting from table - to another table is a process where (usually) so called Buffer tables are involved.
Imagine you want to summarize information of two tables and display in one line in the report or you want to do a special sorting (like the top ten items).

You need to "preprocess" the records in one dataitem and build up a temporary table, then you use the integer dataitem in order to print the records from the temporary table.

2. Another use of the integer table is to print a certain information exactly n-times, 
like number of copies of special footer or header sections. 

Report 205 is a good example that combines these 2 issues.

The CopyLoop Dataitem refers the number of copies + orginal you want to print,
RoundLoop prints in fact the sales lines, that have been prepared beforehand in a temporary variable SalesLines.


Sometimes we use 2 integer dataitems in a report with an indentation, why do we do that?
The reason there are 2 integer loops is:
- copyloop to iterate the total number of copies
- pageloop to set the format correctly (for the pages with the header sections) as you can't use an integer as a top level for a document as you cant pass a record along to the report in a standard way (like report.runmodal(50000,Rec)


Example of usage of Integer dataitem(Report 113 example)

Let’s have a look at some examples of temporary datasets. After that, we will create a report which will work with temporary data. In our demo, we will be using Dynamics NAV 2013 R2.

Open the Object Designer, locate report 113 Customer/Item Sales and click the Design button. The report is designed to have the Customer table as the top level data item, with Item Ledger Entry and Integer tables indented below as shown in below screenshot.



The Integer table is the one that holds temporary data. Let’s have a closer look at what’s inside. Select the Integer dataitem and hit F9 to open the code:



The ValueEntryBuffer table is actually only temporary. It is used to fill in the necessary data and then represents it in the report. Click View, C/AL Globals and locate the ValueEntryBuffer variable. Click Shift+F4 to open its properties:















The Temporary property is set to Yes, indicating that after processing the report, all the data in the table will be cleared and will not physically exist anymore in the database. Close the Properties and C/AL Globals windows.

Next, let’s have a look at how to work with the temporary table. Since we cannot place the temporary table as a dataitem in the Report Dataset Designer, we have to use an Integer table. This table is virtual and does not exist in the database, instead only in memory.


Step 1:

If we look at the code, we will see that the report will work with a range of rows
starting from the first row till the last row of our temporary ValueEntryBuffer table

Integer - OnPreDataItem()

ValueEntryBuffer.RESET;
SETRANGE(Number,1,ValueEntryBuffer.COUNT);




Step 2:

Once the range of records is set, we start running through every next record until the end as shown in above screenshot.

Integer - OnAfterGetRecord()

IF Number = 1 THEN
  ValueEntryBuffer.FIND('-')
ELSE
  ValueEntryBuffer.NEXT;

Step 3:

When it comes to processing the Integer dataitem, we should already have our ValueEntryBuffer table filled in with values.
This is done with a previous dataitem, Item Ledger Entry(in our example). Select this dataitem and hit F9 to open the code.


First of all, the temporary table is reset from all filters and cleared from data

Item Ledger Entry - OnPreDataItem

ValueEntryBuffer.RESET;
ValueEntryBuffer.DELETEALL;

Next, it is being set to range from the same item no. values which exist in the Item Ledger Entry table

Item Ledger Entry - OnAfterGetRecord

ValueEntryBuffer.SETRANGE("Item No.","Item No.");

Once the range is set, the temporary table is ready to be filled in with the necessary values for the primary key 
and modified with the calculated amounts necessary for the report.

IF NOT ValueEntryBuffer.FINDFIRST THEN BEGIN
  ValueEntryBuffer.INIT;
  ValueEntryBuffer."Entry No." := NextEntryNo;
  ValueEntryBuffer."Item No." := "Item No.";
  ValueEntryBuffer.INSERT;
  
  NextEntryNo := NextEntryNo + 1;
END;


As we see, the pattern is quite clear when it comes to using temporary tables in the datasets.

I hope this clarifies all questions related to Integer data items and usage of temporary tables in reports. Drop a mail to me in case of any queries.