How to: Filter Tokens in Microsoft Dynamics 365 Business Central MSDYN365BC

If your customer is using complex filter in List page and wants to save the Filter of list page and use the Filter Frequently for all the related pages then we can use Filter Token.

In the client, when filtering lists using the filter pane, users can enter filter tokens, which are special words that resolve to one or more values. This powerful feature makes filtering easier by reducing the need to navigate to other pages to look up values to enter as filter criteria.

You can add custom filter tokens and make these available in any language and across the application.

To add your custom filter token, you need to define the token word that users will enter as filter criteria, and define a handler that resolves the token to a concrete value at runtime.

Example

codeunit 50102 FilterTokenSimple
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Filter Tokens", 'OnResolveTextFilterToken', '', true, true)]
    local procedure OnResolveTextFilterToken(TextToken: Text; var TextFilter: Text; var Handled: Boolean)
    var
        MyVendorTxt: Label 'DivyeshVendor';
        MyVendor: Record Vendor;
        MaxCount: Integer;
    begin
        if StrLen(TextFilter) < 3 then
            exit;
        if StrPos(UpperCase(MyVendorTxt), UpperCase(TextFilter)) = 0 then
            exit;

        MaxCount := 2000;
//Add Filters according to your requirement
        MyVendor.SetRange(MyVendor."Responsibility Center", 'LONDON');
        if MyVendor.FindSet() then begin
            MaxCount -= 1;
            TextFilter := MyVendor."No.";
            if MyVendor.next <> 0 then
                repeat
                    MaxCount -= 1;
                    TextFilter += '|' + MyVendor."No.";
                until (MyVendor.Next = 0) or (MaxCount <= 0);
        end;
    end;
}

To try it out in the client, open the Vendors Or Posted Purchase Invoice page, filter on No. field, and type in a substring that starts the same way with the chosen token word, like %Div.

How to: Define Views in Microsoft Dynamics 365 Business Central MSDYN365BC

Import and Export Data in Microsoft Dynamics Business Central (MSDYN365BC) 

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

How to: Define Views in Microsoft Dynamics 365 Business Central MSDYN365BC

In Dynamics 365 Business Central we can define Views to provide an alternative view for data that customer needs very frequently.

For eg: Released Sales Order, In Stock Item in Item List, Out Standing Customer in the Customer list.

Snippet :tview

A view offers:

  • Filtering on multiple table fields.For more information, see Filters.
 Filters = where("Item Tracking Code" = filter(<> ''));

  • Sorting of the data.
OrderBy = ascending ("Item Tracking Code");
  • Layout changes, modifying page columns.
layout
{
    movefirst(Control1; "Item Tracking Code")
    modify(Control1)
    {
        FreezeColumn = "Item Tracking Code";
    }
}

The following example shows a page customization of the Item List page. The definition of the view adds a caption which is displayed on the left side in the UI.

If we Run Item List in Dynamics 365 Business Central mordern Client then we can see it as shown in below screenshot.

Create PAGE Extension in MSDYN365BC

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

Error: The page type xmlport is not supported in Microsoft Dynamics 365 Business Central MSDYN365BC

Hi ALL,

While running XMLPORT in business Central i came across an error “The page type xmlport is not supported in Microsoft Dynamics 365 Business Central”

You can ref my blog on Creating and Running XMLPORT

Import and Export Data in Microsoft Dynamics Business Central (MSDYN365BC) 

You are getting this error because the Web client does not support displaying the Request page of XMLPorts.

To resolve this as shown in the below screen shot add False for the RequestWindow.

Xmlport.Run(50100, false, false);

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

How to: Join Data Items to Define the Query Dataset in Microsoft Dynamics 365 Business Central MSDYN365BC

Hi All

Query objects can also perform calculations on data, such as finding the sum or average of all values in a column of the dataset.

Business Central query objects enable you to retrieve records from one or more tables and then combine the data into rows and columns in a single dataset.

As an example, i have created query object that’s been defined in AL so that it retrieves a list of customers, along with their sales line data

You can create a query in AL by using the tquery snippet as shown in below screen shot.

To create a link between these two tables, you could set the DataItemLink property of the Sales Line data item as follows

DataItemLink = “Sell-to Customer No.” = c.”No.”;                   

 SqlJoinType = InnerJoin;

Create a new Codeunit 50100 and added filter to retrive the record according to requirement where Quantity is greater than 10 and display the same in Text box.

I have called this Codeunit on Sales Order page and it will be displaying data in the text box.

To understand what values are stored in the dataset it will be

TablesCustomerCustomerSales Line
FieldsCustomer_NumberCustomer_NameQty
DataCUST01Blanemark Hifi Shop72
 CUST02Beef House34

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

How to identify subscriber events in Dynamics 365 Business Central?

Hi ALL,

Eventing is major part while upgrading to business central, we face alot of customisation done in Customer database which needs to be evented and converted into extension.

You subscribe to events to extend application and interact with the base application and other extensions. This topic describes how to discover events that you can subscribe to without writing the code manually

I suggest you to see the topic mentioned below before moving further on this

Why Event & Extensions for Microsoft Dynamics 365 Business Central (MSDYN365BC)? 

I have got some query about how to identify the EventSubscriber for AL code. So lets take a dive into this.

Record Events

To record the current session, Search for Event recorder in Business Central click the Start button located on the actions ribbon.

After starting the Event Recorder do not close the Window, open the session in different window.

Perform all the actions that you want to record while the Event Recorder session is on. For example, we want to make External Document No. Mandatory in Sales Order (which is default feature)

I will try to post the Sales Order and check go to Event Recorder window and stop

You will get the list of Event occured while doing this activity as shown below

You can directly copy the event subsciber code from GET AL Snippet

Copy the EventSubscriber and add a new Codeunit as mentioned in Why Event & Extensions for Microsoft Dynamics 365 Business Central (MSDYN365BC)? 

You can ref for some more example on Events mentioned below.

Part 1 of this topic:How can we flow a custom field from Journal to Ledger for AL project in VS Code for MSDYN365BC.

Part 2 of this topic:How can we flow a custom field from Journal to Ledger for AL project in VS Code for MSDYN365BC continued..

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

Creating a Word Layout Report in Microsoft Dynamics 365 Business Central MSDYN365BC

Hi ALL,

HAPPY NEW YEAR !!

In todays blog we will be discussing about Creating Word Layout in Business Central MSDYN365BC

If you want to Create RDLC Layout then ref to my previous blog

Creating an RDL Layout Report in Microsoft Dynamics 365 Business Central (MSDYN365BC).

So lets begin with Creating a AL File For the Word Layout

AL file for WORD LAYOUR in MSDYN365BC

As shown below New report is being create with DefaultLayout As WORD for Item Table

I have added few fields for demo purpose, you can add fields according to your need.

After creating the AL File, build the extension (Ctrl+Shift+B) to generate the MyWordReport.docx file.

Create PAGE Extension in MSDYN365BC

I have creeated page extension of Item List page and added the report to Run on Open Page event, so when you go on Item List this report will run.

You can specify you report to run on Action as well.

Open the Word report layout document in Word.

Once the MyWordReport.docx file has been open in Word layout enable the Developer TAB

If you do not see the Developer tab, go to Options, then Customize Ribbon, and in the Main tabs section, select the Developer check box as shown below.

On the Developer tab, choose XML Mapping Pane, in the Custom XML Part dropdown list, choose the custom XML part for ADD INCLUDE report, . The name of the custom XML part has the following format

urn:microsoft-dynamics-nav/reports/report_name/ID

Add data field in Word Layout in MSDYN365BC

  1. Add Table with 4 column and 2 rows
  2. Right-click on the Item table, and in Insert Content Control, select Repeating to add the repeater data item in the 2nd row
  3. Right-click on the field and in Insert Content Control, select Plain Text to add the column as a text box.

Save the report layout when you are done and then close it.

Back in Visual Studio Code, press Ctrl+F5 to compile and run the report.

Now open the Client and run Item List, and Report will be Run while opening the List and You can preview it as shown below.

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

Creating FactBox in Microsoft Dynamics 365 Business Central

Today, I was working on new Merging for Upgrade to Business central and i came across FACTBOX in Business Central. So i thought of sharing this with you.

Factbox area is normally located on the Left side of the page and is used to display content including other pages, charts, and system parts such as Notes, and Links.

Creating a factbox can be done in two steps.

  1. Creating a factbox Page
  2. Adding a FactBox area to a page

Creating a factbox Page

ItemDetailsFactbox in MSDYN365BC

Here i have Created a new page of type CardPart with Sales Line Table to display Item No. Description adn Unit Price in the Fact box.

I have added a local procedure to display the same when the Type in the Sales line is Item.

Adding a FactBox area to a page

Link Sales Order Lines to ItemDetailsFactbox in MSDYN365BC

I have extended Sales Order Page and added FactBox with link on Sales Lines

Compile and Run will give you output as shown in below screen shot.

FactBox in Business Central MSDYN365BC

You can ref:

How to Connect Dynamics 365 Business Central 2019 Release Wave 2 to Visual Studio Code (MSDYN365BC).

How to Set up VS Code to Docker in Microsoft Dynamics 365 Business Central wave 2 Release (MSDYN365BC)

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy reading