Showing posts with label AL. Show all posts
Showing posts with label AL. Show all posts

Thursday, April 20, 2023

Configure Business Central Container in Docker

How we can configure the latest Business Central container as Sandbox in docker without License file?


Step 1: Download the Docker by clicking on Docker Desktop for Windows button and install.
https://docs.docker.com/desktop/install/windows-install/


Installation Process:


Step 2: Restart the computer and Go to Windows right bottom corner, find Docker icon, right-click and select "Switch to Windows containers".


Step 3: Open PowerShell ISE with run as administrator and run below script. In the installation process, you will have a pop-up window where you must type your new Username and Password. Password must contain lowercase and uppercase, number, and symbol.


PowerShell ISE Script:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Install-Module BcContainerHelper -Force -AllowClobber

#set accept_eula to $true to accept the eula found here: https://go.microsoft.com/fwlink/?linkid=861843

$containername = "DockerBC"
$imagename = "bccontainer22"
$credential = Get-Credential -Message 'Using UserPassword authentication. Please enter credentials for the container.'
$artifactUrl = Get-BCArtifactUrl -type sandbox -version 22.0.54157.55343 -country w1  -select Closest

New-BCContainer `
    -accept_eula  `
    -containerName $containername `
    -credential $credential `
    -artifactUrl $artifactUrl `
    -imageName $imagename `
    -memoryLimit 4G `
    -auth NavUserPassword `
    -shortcuts Desktop `
    -updateHosts `
    -assignPremiumPlan `
    -doNotCheckHealth `
    -accept_outdated `
    -includeAL `
    -isolation hyperv

Step 4: You’ll get the Web Client URL and other information response.


Login Screen: Use the Credential which you have entered while configuration process.


  • Business Central Container is ready to use.







Tuesday, August 3, 2021

How to modify the Role Explorer (Menu Suites) in Business Central?

Let’s assume that we want to add one custom page or standard page link after the customer page as you can see in below image.


For this we need to extend the standard Role Center page, Find the location of the particular action where you want to add your custom link. In my case I need to add the Custom action after the Customers action.
Here’s the location of customers action in Order Processor RC.



Here’s the custom action which we have added after the Customers action.


Let’s see the result:


Monday, July 26, 2021

How to create Web Client for Business Central?

How we can create multiple Web Client for Business Central to access different DB on the same environment (On Premise)?

Step 1:

  • Need to create Server Instance using Business Central Administrator. Ports should be different than default Server Instance.



  • If you try to access from the web browser then it will not allow you to use this Instance. So, for that we need to create new web instance.



Step 2:

  • Open Business Central Administration Shell as Administrator.


Step 3:

Run command: New-NAVWebServerInstance

Add values in parameters:

  • WebSererInstance: (Name of the Web Instance)
  • Server: Localhost
  • Server Instance: Name of your Server Instance which we have created in Step 1



Step 4:

  • Now, we need to change the port in navsettings file. Path C:\inetpub\wwwroot\Name of your Web Client



Step 5:

  • Port should be same as Server Instance which we have created In Step 1 in navsettings.



Step 6:

Restart your Server Instance and Web Instance.



Monday, May 10, 2021

Custom Connector to connect with Business Central

Note: If you don’t have any customization at business central then you can directly use the Data Source of Business Central, but if you have any customization in Business Central from scratch or extended fields then the Data Source of Business Central will not work for you. To access those custom fields and entities we need to create Custom Connector.

There are so many actions available in Custom Connector like Get, Delete, Post, Put, Head, Options and Patch. So, we are going to look at Get, Post, Patch and Delete.



How to Create Custom Connector?



Step 1: Click on Custom Connector in PowerApps, now, click on New Custom Connector and after that we need to Click on Create from Blank.

Step 2: Add the Name of your Custom Connector, You need to add multiple actions into the one Connector.




Step 3: Now Let’s Add Details in Custom Connector. We need to add Business Central Host in Custom Connector api.businesscentral.dynamics.com.



Step 4: Now move on the Security Tab and add User Name and Password after selecting the Authentication Type.



Now let’s move into the Definition tab

Get

Step 5: Let create Get action first to create get action we need to click on New Action Button as per below image. And need to add function name so it will be visible at PowerApp Side when we develop an app.




After adding the information we need to add the request information. In Request part need to click on the Import from sample.



Now, Click on the Get verb and When you add the URL at that time don’t forgot to add variable for Company Id without that  the solution will work as static. After adding all the information click on the Import Button.

Right now we are in the last step to complete the Get Action in which we need to add the default response from web service of business central.





Now you can test your custom connector from the last Test tab. But let’s do that later before that let’s complete the other actions.

 

Post

Same as the Get action we need to add name of the function and action in the General part.




After adding the information at General Tab we need to add the details into Request tab as below image. We need to select Post action and after that we need to add the URL and sample body which we are going to use in our PowerApps.




Now we need to do same thing into the response part.



Update

Update action will work the same way but for this action we need to add parameters (filters) because business central need if-match formula as well as the sample body and filters to identify which records need to modify. So, let’s start with General Tab. Same as the above two actions we need to add the function and action names into the General Tab.


Now, the main change is in the Request section what we need to do is need to add the filter so the business central web service will identify the records which are you going to modify.



Also the If-Match header is important without that patch call is not going to work. And same as post we need to add the body also into the response section as well.


Delete

We are not going to show all the parts in delete because it is working the same way as Patch just we need to add the all the details from Patch action just one difference between these two is for Body, Delete action will not have any Body.



This is all for Custom Connector now, any developer can use this Custom Connector for Get, Post, Patch and Delete.

Friday, May 7, 2021

How I made Mini Business Central in PowerApps?

I am going to split the content into the steps for better understanding.

Note: If you are new the PowerApps and don’t how to create the App then you can follow below steps in which Microsoft will create demo app using our Business Central web service, Based on that we can follow further.


Step 1: Click on the Other Data Source Button as per below image.




Step 2: We need to choose our Connection in this case I am going to choose Business Central web Services.




Step 3: Now Choose the Data Set.



Step 4: After choosing the Data Set we can choose our Entity of Business Central.



Step 5: That’s it now PowerApps will create one demo app automatically, so we can have better idea that how to create Form, Gallery, and navigation.



Above are the steps for the beginners, but now I am going to show you that what I have created?


As you can see in above page, it is looks same as Role Center Page of Business Central Right? Let’s move into the technical Area of this App. In this content I am sharing the main component details with you which I have used in this app.


Screen 1: Role Center Screen

As you can see in below image the left side is Component Area, and the Right side is the properties.



In the Role Center Screen I have used the Blank Screen and for Que I have used the Rectangle Components.



-        And in Bottom Part of the App you can see the 5 Options those are the button so you can navigate from this screen to anywhere you want.

-        Here’s the sample formula for navigate from one screen to other, Navigate(BrowseGallery1_1, ScreenTransition.None)

-        For Counting the Record from web service we have the formula like CountRows(vendors).

-        In PowerApps we have many formulas for all the operations.

One more thing I want to add is that Properties Let me show you one example for that.



As you can see I have added navigate formula on select trigger and into the text property added count formula.

Screen 2: List Screen

In this app I have tried to copy Business Central concept like Role Center, List Pages, Card Pages So, Let’s go through the List Pages.




-        In this Screen I have used the components like Gallery, Icons as Button, Button, and Rectangle for Horizontal Line.

-        When we have more than one records to show on the screen at that time we can use Gallery components.

We just need to add the Vertical or Horizontal Gallery from Components and just need to add Data Source.



Once you click on that component it will ask you to select the Data Source.



-        As you can see in the Screen 2 I have added one floating button of Add, I will discuss about it later once we get to the New Form Part. Now let’s move on the Detail Screen.

 

Screen 3: Detail Screen




-         As you can see in above image, I have used One Icon for back to the previous screen, Edit Icon to navigate edit Screen, One Form, two or three Labels, Let’s talk about Form.

-        The Purpose of Detail screen is to show particular record in details, we cannot add all the fields at List level so, that is why we have added Form in which we can add as many fields we want.

-        How the form will identify that which record they need to open? For that we need to add one formula in Item Property BrowseGallery1.Selected we need to Gallery name and .Selected so the form will show the record which you have selected on Gallery.

-        Now, Let’s move on edit and back for Back icon I have one formula in which user can go to the previous page or any other page Back() by adding back it will let you go in previous page.

      To Edit a page we have formula EditForm(ItemEditForm_1);Navigate(ItemEditScreen, ScreenTransition.None) we just need to add edit form and form name after that we just need to add navigate formula in the icon.



Screen 4: Edit Screen



As you can see in above Image I have created new screen for Edit in which user can edit the records, and sent path request.

In this Screen we have used two buttons one for cancel edit, Submit changes, Edit Form. And never forgot to add the Item Property as per detail screen.

-        We just need to add FormMode.Edit to make all the fields are editable in the form.

-        For Submit we have one formula SubmitForm(ItemEditForm) Itemeditform is the name of form which we are using in this screen.

-        And for cancel icon we have added the formula ResetForm(ItemEditForm);Back().

So, that's it for the Business Central App in PowerApp.


Little Demo of App: