How to export data using TextBuilder in Business central.

Today we will see how we can data from business central table using new data type Text Builder.

To check how this data type work build small program as below which pick up data from customer table and export the data in text file.

pageextension 50101 CustomerMasterExtension extends "Customer List"
{
    actions
    {
        addlast(General)
        {
            action(DataExport)
            {
                Caption='Data Export to Text';
                ApplicationArea=All;
                PromotedCategory=Process;
                Promoted=true;
                Image=ExportDatabase;
                trigger OnAction()
                var
                CustomerMaster :Record Customer;
                Tempblob:Codeunit "Temp Blob";
                TextFileBuilder :TextBuilder;
                FileName:Text;
                InStreamData:InStream;
                OutStreamData:OutStream;
                begin 
                    FileName:='CustomerData.Txt';
                    TextFileBuilder.AppendLine('Customer No'+','+'Customer Name'+','+'Balance');
                    If CustomerMaster.FindSet() then repeat
                        CustomerMaster.SetAutoCalcFields(CustomerMaster.Balance);
                        TextFileBuilder.AppendLine(CustomerMaster."No."+','+CustomerMaster.Name+','+Format(CustomerMaster.Balance));
                    until CustomerMaster.Next()=0;
                    Tempblob.CreateOutStream(OutStreamData);
                    OutStreamData.WriteText(TextFileBuilder.ToText());
                    Tempblob.CreateInStream(InStreamData);
                    DownloadFromStream(InStreamData,'','','',FileName);
                end;
            }
        }
    }
}

If you look at the above code it is taking required data from customer table and export the data in text file as below.

To get more insight of data type have a look at MS documentation from below link

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/textbuilder/textbuilder-data-type

Hope this will help you.

Stay tuned for more.

How to define multiple layouts for report in Business Central

With the release of business central V20 lot of new features are introduced and one of the features in you can define multiple layouts for reports while developing

In earlier days we are defining multiple layouts as below.

Now with the new release new rendering section is added while creating report in AL development

In the above rendering section we can define multiple layout as below

After compilations of report we can see the layout is created as below

Isn’t that cool features for layout

This features is available for Runtime 9.0

Hope this will help you..

Stay tuned for more.

Preview Environment for Business Central 2022 Wave 1 (BC20)

So with new year major version of business central is about to release and in context of that Microsoft released preview version of business central 2022 Wave 1 (BC 20). This preview version only possible to create for Sandbox and non production environment.

How to get this preview environment to get the hands on the new release

On the cloud version of business central one can create Sandbox as below for preview version

This preview version available on docker also.

For Docket Artifacts user following PowerShell command.

Get-BcArtifactUrl -storageAccount BcPublicPreview -country <country> -type <type>

To understand more about the features of BC20 you can visit here

Stay tuned for more on this version

Business Central allows to change App Name Publisher of app.

With the release of Business Central Wave 2 2021 aka BCV19 lot of new features has been added to make life easier of developer and/or customers.

Can we change App name and/ or publisher name to meet marketing branding ? If you ask me till V18 it was not possible to change that and in V19 it is possible.

Lets see how it works.

Here is my app.json file

Publish the app

Changed the app.json

Hopefully this will help to give branding name to your app even after published.

Stay tuned for more.

Microsoft Business Central 2021 Wave 2 released

Microsoft releases business central 2021 Wave 2 (BC 19) on 1st October 2021 .

This version is available on

  1. Cloud
  2. On Docker
  3. On Premise

To check I tried to create new sandbox on cloud environment and it is readily available on my region too,.

Apart from this to get more detail and understanding on new version Microsoft already scheduled a launch event with breakout session .You can register here Business Central Launch Event

For On premise version you can download from following link

Business central On-Premise Version Download

New Version for AL language also available to update.

Stay turned for more updates and keep exploring..

How to modify table data in business central

This week one of the customer post few transaction and found that one of the field user enter some wrong information. In ideal situation user need to reverse the transaction and post correct transaction which is safest approach.

But do you remember those old days where we have access to the table and can modify the data but with business central this ability no more available . I just build one small extension to modify the data in the table where in we can modify the posted data .

Important: It is not recommended to change data in the tables directly as it will cause inconsistency in database and make database vulnerable.

Just check following video to check small amount of work I did.

Additionally I found blog from Volodymyr Dvernytskyi for Data Editor .Please have a look into it.

Let me know your feedback.

What is planned for Business Central Wave 2 2021 release

As we are gearing up for new release of business central and already the buzz is started for new version . Here I will list few upcoming features which I am looking forward in new version.

Following features I am looking forward.

Richer access control for extension source in cloud environments

Add additional columns through personalization in various pages to gain more insight

List of trusted partner apps

Profiling AL performance with snapshot debugger

Transactional installation and sync of extensions on-premises

Restarting environments

Unhindered data entry across rows

Decimal separator on numeric keypad matches region setting

Discovering reports and administration areas in Role Explorer

Copying environments of different types

Do let me know yours…

How to Delete extension data in business central

With the release of Business Central Wave 1 2020 new feature added to delete the extension data from production or sandbox. Prior to that we can uninstall the extension but data still there for the extension.

This feature will be useful when

1) Application is not in use.

2) Customer have desire to reinstall the extension data from scratch.

Let see how to uninstall and delete the extension data.

1) Launch the business central and search for extension management.

2) Select the required extension for uninstall. In this you can see new option added for delete extension data .

3) After selecting the option then you will get following warning message.

4) After click ‘YES’ then you can see ‘Delete Extension Data’ will get enable as follows

5) After that you can click on Uninstall then system will again warn before starting deleting data from extension.

6) If you are sure then click ‘YES’ and it will start processing to delete the data. This can not be undone.

Hope this will help and stay tuned for more.

If you like my blog then please connect me on

Blog :-https://ammolhsaallvi.blog/

Twitter :-https://twitter.com/ammolhsaallvi

LinkedIn :-https://in.linkedin.com/in/amolsalvi

How to Create Custom Event in Business Central

Looking at the subject there are lot of blogs available but I am writing this based on one of the request from my colleague.

Everybody aware of that whenever you developed an app it need to be extensible and if anybody would like to add or modify any field or additional routing we need to have events which can extend the base functionality.

Step 1 :- Simple Quick action to add event in Business Central

Next step will be we can subscribe the event and add you own code.

It is so simple to add custom event in AL and allow other to extend your functionality.

Hope this will help you.

Stay tuned for more updates.

How to extend enum in Business Central

With the release of Business Central 2020 Wave 1 lot of new features has been added to make product more prominent.

Though this concept of ENUM was introduced earlier but from new version onwards most of the option fields are available as extensible enum such as follows

If define enum is extensible then we can add more option values in that field.

How to add the new option value in existing enum field.

First create extension for enum as below

To check the value just added one action button as below

To check the output publish the app and check

Select the document type and check the result as follows

Hope this help you…

Stay tuned for more..