Allow users to filter random records in Dynamics NAV

Most of the users would like to select few records (No commonly shared value) and filter them to a single view. I have seen many of the users use export to excel option available in Microsoft Dynamics NAV and then filter the records from excel so that they can compare them freely. 

What if we can provide an option for the users to ease their life by adding custom filter option. I had a small idea about MARK record option in Dynamics NAV and start to look for a better solution. Then I found a nicely written blog article by Mark Brummel (One of the best) about the Mark functionality in Dynamics NAV. 

Let’s start to make a custom filter function to Dynamics NAV. If you generalize this then this can be able to use globally within Dynamics NAV. 

My requirement is, able to select random records in a list page and then able to filter them to a one single view. 

To demonstrate this I will use Customer Ledger Entry page in Dynamics NAV. 

In here I want to add 3 buttons which will do following
01. Mark the records
02. Filter the marked records
03. Clear the filters

In order to add the buttons, I will open the Customer Ledger Entry page in the development environment and go to Action Designer


In the action Designer, let’s add 3 buttons Mark, Marked Only and Clear Marks. Then I make them promoted and big and also added to Category4.


Then let’s write small code to do the work.


Add above code to each OnAction trigger. Once you complete the code it will look like below


Now we are almost there, just move back to the page designer and open the properties of the page. In the PromotedActionCategoriesML add the Mark at the 4th option (Since we added our new buttons to Category4)

Before we exit from the page we have very small task to do. In order to visualize the Marked records we need to add a new field to the page. Add a new column and set the source field to “MARK”. 

Once that is been done, compile and save the page. 
Let’s run the page and it will look like below with nice ribbon with the all new custom filter buttons. 

Now user can select random records by clicking on the “Mark” button.

When the user click on the Mark button system will select the record and also it will show a tick mark in the page. Once the records are been marked, next step is to filter the marked records to have a one nice view. In order to do that user just have to click on the “Marked Only” button.

See.. System will filter the marked records and create a one simple view. Once the work is been done and user want to un-mark the view, user need to click on the “Clear Marks” button and it will un-mark the records.

But this is a empty record view and what has happen to the rest of the records?? To get all the records just click on the “Marked Only” button again.

User will get the original view with all the entries.

Simple?? Yes it is!! It is a really easy way to provide a custom filter to users. + We didn’t work with any record variables or created any variables, you can just copy paste the action button to the other pages and use this functionality.

Or if you need you can make this function a global one with the use of a codeunit and RecordRef. Up to you to decide.

Hope this was helpful and if you need the page object you can get it from this link. Or you can use below code and directly add to the page (text).

Please provide your feedback with a comment. 

Thank you and Regards,
Tharanga Chandrasekara

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

2 comments

    • Unknown on September 20, 2017 at 2:38 pm

    very nice,

    onlything that does not work is when you open the card of the record.

    it will open but the markedonly filter will not be enabled, when using the next and previous button you will find out that it has the whole set and not the marked set (which was active in the list view)

    • Unknown on September 20, 2017 at 2:38 pm

    very nice,

    onlything that does not work is when you open the card of the record.

    it will open but the markedonly filter will not be enabled, when using the next and previous button you will find out that it has the whole set and not the marked set (which was active in the list view)

Comments have been disabled.