Jigsaw Blog



NAV RTC Development Tips

Here are my Microsoft Dynamics NAV RTC development tips, enjoy. Steve.

Dynamic Properties

Properties of controls can now be set dynamically. (Well, more dynamically then before). For example, the cells in a column (in a grid) can have a different editable value for each row. I'll describe a quick example of how to do this.

In this example, I have added a new boolean (checkbox) field to the sales line called "Faulty Item Replacement". If this checkbox is checked (true), the price fields (unit price and line amount) should be set to zero, and made not editable. The setting to zero is the same as before - I wont discuss this bit. I'll discuss the rest. To do this, I:

  • Added a new Boolean variable to the "Sales Order Subform" page called "PriceDetailsEditable", and set the "IncludeInDataset" property of this variable to true.
  • Made a new function called "UpdatePriceDetailsEditable". This had one line of code in it: "PriceDetailsEditable := NOT "Faulty Item Replacement";"
  • Added call to UpdatePriceDetailsEditable function in the OnAfterGetRecord event.
  • Added call to UpdatePriceDetailsEditable function in "Faulty Item Replacement".OnValidate event.
  • In the "Unit Price" and "Line Amount" fields, I changed the Editable property to "PriceDetailsEditable".


Thats it. The Boolean variable "PriceDetailsEditable" is kept up to date by the calls to the UpdatePriceDetailsEditable function, and this maintains the editable property of the price fields.

I don't think there are any shortcuts in doing this. You cant create a function, and call this function in the editable property. It needs a Boolean variable, which has been included in the dataset (the IncludeInDataset bit is kind of important).


When opening a page using the properties of an "Action", you can define the RunFormMode. This can be either View, Edit or Create. This use of these should be obvious, and they change the functionality of the form/page opened quite considerably.