Dynamics NAV Web Client – Filtered look up for Document creation

In Microsoft Dynamics NAV 2013 Windows client, When creating a Document (Sales Order/Quote/Invoice, Purchase Quote/Order/Invoice etc..) Filtered look up works wonderfully.

For example, when creating a new sales order, type few letters of the customer’s name in Sell-to Customer No. field and you will get a filtered list as shown below. This makes choosing a customer very easy in Sales order creation process.

Sales Order Creation in Windows Client

 

When we try to do the same in Web client, we get an error!!

cap2

 

In web client, we will have to click on the assist-edit button to open the full customer list and then apply a filter on Customer Name column and choose the customer from the filtered list.

However, with a small customization, you can skip these 3 to 4 extra clicks for creating a document in web client!

I tried the following on my Cronus International database with the Sales order page. I tried with Sell-to Customer Name field instead of Sell-to Customer No. field because Sell-to Customer Name does not have any table relation specified.

In Sales Order page (42) design mode, I created a new function called GetCustNoByName. This function takes the user entered letters as input parameter and shows filtered view of customers. The end user will be able to select the required customer directly.

Function Parameter, Return value and Variables are as follows:

Function Parameter, Return value and Variables

Code within the function:

GetCustNoByName function code

 

Now, We need to call this function from the Sell-to Customer Name field in Sales Order page (42) to bring up the filtered list. Once the list is open, user selects the required customer. That particular customer number will be passed into CustNo (Code:20) global variable.

next, we need to validate the Sell-to Customer No. with CustNo variable, which will automatically fill up all the required fields on Sales order page.

 

Calling the function

 

Save the Page 42 after the above customization and try to create a new sales order using the web client.

This time, search for your customer on Sell-to Customer Name field and press enter to get the filtered view to select from directly:

After selecting the required customer from the list, Sell-to Customer No. , Sell-to Customer Name, Address etc… will be filled in automatically.

The GetCustNoByName function can be created in a CodeUnit and be accessed by Sales Quote, Order, Invoice etc..

This method can also be used to get vendor number by name for purchase documents.

 


Please note: These sample codes are provided for guidance only. The provided information, while authoritative, is not guaranteed for accuracy and legality.