4 May’18

Dynamics NAVHow to update the selected line in the Subform on click of an action button in the Mainform in NAV


  • The requirement was such that , the user will select a line in the subform.
  • The subform has fields like the Customer ID, Customer Name, and a field Recieved Crates.
  • On click of the action button in the Main form, a page opens which contains the details of the selected line in the subform  like Customer ID and Customer Name also a field Crate recieved(Integer Datatype).
  • User will enter Crate Recieved and click on OK. The number entered in the Crate received will modify in the Recieved crates field in the subform.

This blog explains the step wise procedure to achieve the above output.


Microsoft Dynamics NAV 2017


1. Open the Developement Environment of Microsoft Dynamics NAV and open the Main form(card Page) and create an action button Received Crate and write the below code.

Here, “Crate Lines” is the Page control (subform), Here a call is made to CallLinesfromCard  function with Parameter CratesLine.

CallLinesfromCard is a global function made in “Crate Lines”Subform.

2. In the function CallLinesfromCard  in the subform. Below is the code.

Here ReceiveCrate is a page. Its the page that open on click of the action button. A function is called CrateReceivedFromCust with parameter CrateLinesTable.

3. A global function is made CrateReceivedfromCust in the page ReceiveCrate. Here global fields variables are made CustomerID,CustomerName,NoOfcratesShipped.

Theses fields are autopopulated with values from the selected line.

A field Crates Received is also created where the user will enter data.

4. OnQueryClosePage of Receive Page, below code is written to modify the Record of the Subform.

5. Set the property RefreshOnactive to yes on the Subform and Mainform.

Written by

Chris D'Silva

Software Developer

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Commands to Import .bacpac file to D3FOE SQL Server

    14 May’ 2018

    Introduction: This blog article will explain how to import a .bacpac file to Microsoft SQL Server which is created from ...

    Read more
  • [Solved] – Backspace not working in HTML Web Resources

    11 May’ 2018

    Issue: When we use a HTML web resource in Dynamics 365 CRM forms or even as a separate navigation, we sometimes face is...

    Read more
  • Dynamics 365 Tip: Sending Emails using Unified Interface

    10 May’ 2018

    Introduction: The unified client which was released D365 V9 had a very refreshing UI and lots of features. One of the b...

    Read more
  • Filtering Records on BPF unlike on Form – D365

    10 May’ 2018

    Introduction: Working with D365 is best when you’re trying to use as much OOB stuff as possible. Simplest configurati...

    Read more
  • Filter records in gallery control based on value selected in other gallery control in PowerApps.

    10 May’ 2018

    Introduction: This blog explains how to Filter records in gallery control based on value selected in other gallery cont...

    Read more