How to Build Power Portal connected with Business Central

Introduction

When I think about new Dynamics 365 Business Central (in the future, I’ll use only ‘Business Central’ or just ‘BC’) features, the first things in my mind are openness and integrations. Then one of the most common limits in Business Central (and in Dynamics NAV before) was lack of portal connected with the database. Of course, you could develop portal from the scratch or use one of existing solutions and develop integration… But what is common in both of these cases? You need to pay in the first case for development (not so cheap) and in the other case for IP or license (again not so cheap).

But with Power Platform we got something more. Now we have Power Portal and as you have Power Platform included in your user’s subscriptions, you don’t need to pay something more (minimum, not such a big amount of money). Only what you need to pay is using portal, but this is really not so costly (100USD per month for 100,000 page views for unauthenticated users or 200USD per month for 100 daily login sessions for authenticated users. More details here: https://powerapps.microsoft.com/en-us/pricing/). And yes… we have an issue here… Power Portal is based on Dataflex Pro (formerly known as Common Data Service). But this is an opportunity, not a limitation. And this is the topic of this whitepaper.

Start with building entities in Power Platform

First as I already mentioned, this is necessary to build solution in Dataflex Pro and that means you need to create entity(ies) you want to connect with Business Central. That means you need to run Power Apps: https://powerapps.microsoft.com/. After that, I’ll continue with task. In this example, I’ll use Employee entity as we already have Employee table in BC.

To do this, you need to start from Entities (Data > Entities in the left navigation pane) or you can start with Solutions and create new entity from there. In the new entity, enter Display name and enter primary name.

Click Done when you enter that. After that, you need to add new fields using Add fields command. When you finish with all fields, click Save Entity to save all changes.

When you finish with all details in creation of entity you can start with building connection with Business Central. But keep in the mind that you need to make something more here and we will come back later. Right now, only one thing you can add is Key just to avoid having duplicates and my recommendation is to copy keys from BC table.

Connecting Business Central with portal

OK, connection with the Business Central can be done on a few different ways and I’ll try to explain all of them here.

Business Central customizing an integration with Common Data Service

From the Wave 1 2020, Business Central supports an integration by default with a set of entities in the Dataflex Pro default database, but you can make customization through extension and add more. For developing extensions that integrate Business Central with Dataflex Pro, system uses extensibility capabilities where proxies to Dataflex Pro tables can be created in Business Central, and these will be made extensible. This allows for custom attributes to be synchronized and for additional tables to be added to the default synchronization process.

When you create this extension, only what you need to do is mapping tables with entities as well as mapping fields in Business Central and Dataflex Pro.

I don’t want to write in details how you can do it as Microsoft already published completely documentation how to build this kind of extension and how to configure it. For more details, open this page: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/administration-custom-cds-integration.

When you finish with developing an extension, you can find here how to map tables and fields: https://docs.microsoft.com/en-us/dynamics365/business-central/admin-how-to-modify-table-mappings-for-synchronization.

When you connect entities in Dataflex Pro and Business Central, you can continue with building Power Portal.

Integration using webservices and Power Automate

Previous way of integration is native, but it requires some development knowledge. But what if you are not developer and still want to build portal based on Business Central? Do you think it is possible? Yes… this is an answer.

From the Entity page in Power Apps, just click Get Data and in the Power Query window choose OData tile. Go next and then you need to stop yourself there. You should move to the Business Central. Open Web services page and add page you want to use in synchronization. In our case, this is page 5200… just click New, as Object type choose Page and add this page number; enter Service name you want to use and click on Publish field. Copy OData V4 URL value.

Move back to the Power Apps and in the Connection setting paste this value to the URL field. Choose Organizational account as an Authentication kind. Confirm your credentials and go to the next page. Click Next until you open the following page.

Now you need to choose Load to existing entity option and in the Destination entity choose entity you created (in my example BCEmployees).

In the Field mapping part of window (right side), you need to map fields from web service in Business Central as a Source column with Destination fields (fields in our entity). When you finish it, just click Next and you will find a page where you can configure refresh settings. That means you need to choose how often system will synchronize data from Business Central web service to the entity. Click Create and you have been finished with integration.

But something will miss here. As you are using just refresh model, that means you will get records from Business Central, but you cannot insert there. Actually, you can insert to entity, but system will not insert them to BC. To solve this, you can create very simply flow in Power Automate. Actually… you will need as many flows as you want actions.

You can see on previous picture that I chose When a record is created and it will be OK if you want to have only Insert from portal. But if you want more action, you need to use the following triggers:

  • For ModifyWhen a record is updated,
  • For DeleteWhen a record is deleted.

In this example you will see flow for inserting, but I think you can easily understand how to create two additional flows based on well-known parameters.

Keep in the mind that you need to use the following parameters in the trigger:

  • Environment – choose an environment you used for building solution in Power Apps
  • Entity name – entity you created
  • ScopeOrganization

Now when you save it, your solution is finished. I would just like o mention that instead of web service integration you could choose API integration as well:

Configuration in both of cases is very similar and there is not a reason to repeat completely process.

Building a portal

Power Portal

Now when we made an integration using one of the models, we can continue with building our portal.

To finish with this process, we need to open Power Apps again and to start with creation new Power App. You can start from Home or from Create and you need to choose Portal from blank option.

Enter the name of your portal and carefully choose Address for your portal. This is place where you can also choose a language.

When you select Create, you need to be ready to wait some time until system create portal. It usually takes a few minutes, sometimes more, sometimes less… but be a patient. When an app is created, open it in the edit mode. You will see we have prebuilt portal, but we want to add new page with our data. To do this, select New page and choose Blank.

System will create new blank page and we need to add necessary components. Select Components icon in the left-side menu and locate List. This is logical if you want to start with a list view.

Now you need to configure some details. As we will create new component, choose Create new display and as Entity choose your entity (BC Employee in my example). The next important step is to choose a view as each entity has more views. I think that Active {items} are logical choice here.

OK, this is how we can create a list. But if you want to have possibilities to create new entry or to edit or delete it from here, you have an opportunity to do it immediately here. In the right-sided pane you will see a few options appear.

You can choose if you want to add the following features here: creating, viewing, editing and deleting. If you switch-on any of these options, you will get an opportunity to choose which form will be run to make this action. This is very easy for configuration, but what is important is that you need to have these forms already built.

OK, now you need to select Sync Configuration command to see result. But you can see that you have only two columns here in your list and this is not what you want. This is because, when system creates entity, views are created automatically but only with the main field plus Created On. But this is not problem as you just need to customize your view.

View customization

To customize view, you should go back to Power Apps and entity you previously created. There you need to select View tab and from the list of all view to select one you want to customize. In our case it is Active BC Employees.

When you open this view in edit mode, you need to add fields you want to see on your view. I’ll add Name, Surname, Address and City and resize it as I would like to see on the screen.

When you finish with adding and/or moving fields, you need to click first Save and after that Publish commands. Keep in mind that if you didn’t publish it you cannot use it.

Test

Now we can say we finished with everything. Go back to the Power Apps and choose Apps on the left-side pane. You will see completely list of your apps. Just choose app (portal) you just created. When you run it, choose the page we created and that’s it. You can see the window in portal with our data from Business Central.

Advertisement

NAV 2017 Demo Image on Azure

Dynamics NAV 2017 has been published three days ago and we already got NAV 2017 Demo Image on Azure. This is very short period and this is amazing. All people who want to test NAV 2017 don’t need to install it on its computers, but they can use it on Azure. Great job.

Currently, we can create demo image only if we use old Azure Portal. We just need to start with new virtual machine from gallery image and choose Dynamics NAV 2017. We need to configure a few fields and wait a few minutes. And yes, we can use NAV 2017 with a lot of interesting tools.

NAV2017VM1.jpg

But be careful; if you prefer new Azure Portal, you cannot do it. It is still not possible, but I expect it will be done in few following days. Now, just go to the old portal and finish procedure.

NAV2017VM2.jpg

Of course, you can see this VM using new portal as classic VM, but you cannot create it. If you need this VM only for testing, my recommendation is to use D1 or A2 sizes. They are good enough for all tests and you will not spend a lot of your money for this purpose.

When you create VM and run it, you can start with initializing of NAV. On my first sight, there are the same PS scripts as well as on the older NAV demo images. I will test all of them and if I find something new, I’ll publish this.

VMs in New Azure Portal

I’ve already wrote about new Microsoft Azure Portal code named Ibiza. When you look this new portal, one of the first news in that now we have two menus for virtual machines:

  • Virtual Machines
  • Virtual Machines (classic)

AzureVMandVMclassic.png

You will see that all virtual machines you already created using old Azure Portal are placed in Virtual Machines (classic). I want to give you a small descriptions about difference between these two options.

The new Azure Resource Manager with a new API doesn’t uses resources as the old API. Because of that, the classic API stack is still operational, but you’ll see those resources showed up as (classic). You have not a reason to convert classic VM to the new VM. You just need to know that you cannot include classic VM in a virtual network deployed with Resource Manager and they don’t have to be included in a virtual network (unless new VMs must be included).

But if you want to migrate classic VM to the newer model, first you have to be sure you can afford a downtime for your VM. If you can afford it, than you can do it using ASM2ARM PowerShell script. You can find all details here.

I hope, I helped you. I have some more information about it and I’ll prepare a real interesting example soon.

New Azure Portal

Few days ago we got a new Azure Portal general availability. You will open new portal (codename Ibiza) if you use the following URL: https://portal.azure.com/

This portal looks like the following picture and this is now default Azure portal:

AzureNew.png

Microsoft promises really better performance and usability, but I need to test completely portal longer period before I can give my opinion. On the first sight, we can see some new features, but I’ll write more soon.

If you still want to use old Azure portal, you just need to use the following URL: https://manage.windowsazure.com/

NAV on Azure SQL on NAVTechDays

Last week we finished one of the best NAV conferences this year. NAV Tech Days this year had about 950 NAV passionate attendees from all around the world. Everything in organization was the amazing; Luc did a great job.

This NAV Tech Days was very special for me, because I was the speaker on this conference for the first time. My topic on NAV Tech Days was “Deploying and Managing Dynamics NAV 2016 with Azure SQL Database”. This is something new in Microsoft Dynamics NAV 2016. I know, a lot of partners still not use NAV on Azure, but by my opinion this feature can move all of us forward. Azure SQL can save a money and we finally have a good tool for managing our multitenant environment – Management Service Portal.

I gave a word to people on my session that I’ll publish my presentation and PowerShell scripts on my blog. You can find them here:

In few following scripts, I’ll describe all details about using NAV 2016 on Azure SQL Server and give you some answers on additional questions I already got.

2015-11-23_13-19-19.png

How to Create CRM Online Trial Subscription

I suppose all NAV people have already heard that NAV 2016 has natively Dynamics CRM Online integration. This is a really great feature in new NAV release. Probably most of you want to try how it looks like. If you don’t know how to create your trial CRM Online subscription or didn’t try it, this article is for you. I want to show you how to do it, step by step.

First open this web page. On this page, in upper right part, click the “Sign In”. You have to type your Office 365 account.

CRM1

Now you need to confirm this order to get Microsoft Dynamics CRM Online Trial with 30 day subscription for 25 users. After you confirm it, you will open your Office 365 Portal. You will see new e-mail with all instructions and I suggest read it. Click on Login and choose Admin.

Go to your Active Users on portal and add CRM license to you and your other users. You can do it clicking on Edit > Licenses > and check “Microsoft Dynamics CRM Online Professional”. Click Save.

Now you need to choose your CRM App, enter your domain name you already registered (*.onmicrosoft.com) and click “Continue Setup”.

CRM16

You can find potential issue here. Maybe you will not see it, but it is possible. If you get the following error message, try do to next step:

You are not a member of this organization. You (YourAccount@XXXXX.onmicrosoft.com) do not belong to the organization YYYYY. Verify the organization name and try to sign in again.

Resolution: Click the “Sign Out” button on the page that you see the error on. Then log back in with the correct login to access your Dynamics CRM Online organization. This is because the cookies that are used in the Internet Explorer browser sessions are trying to use your previous credentials to login.

Then, you should confirm some details about your language, country and currency. Then click the “Finish” and you can start “get started video”.

And… You’re in! Click on your CRM Online URL you’ve got on this page (copy this URL because you will need it later and for integration with NAV 2016). Now you’ve opened your CRM Online and you have to assign security roles to the new user. You can do it clicking Assign Roles button on the top of the screen.

CRM15

Now, assign security roles in CRM so this user can access your Dynamics CRM organization.

You can use your 30-days trial Dynamics CRM Online subscription. In next article, I will show how you can connect your CRM Online subscription with your NAV 2016.