In this blog, we will see how to create a form with the pattern “Table of Contents”. And use a parameter table to save the data from the form.
Create a Table:
We have created a table with 3 training data information like Training Name, Start date, End date, Complete. And two fields for customer account number and name.
This table is a parameter table that can save only one record for one company. In the properties tab under the behavior, we have an Enum of table group which contains multiple options
Create a Form:
Here we created a Form with a table of contents pattern. And created 3 tabs Training, Development, and System Fields.
Add data source:
We add the august training table as a data source to the form so that we can use the fields of the table in the form.
In the training tab, we have created two sub-tabs Training 1, and Training 2. Both the tab’s patterns are field and field groups. And they contain fields like name, start date, end date, and complete checkbox.
For the Checkbox in the form create a field of enum type and select the ‘NoYes’ enum. Add it to the form and in properties, Data tab select ‘CheckBox’ in the type dropdown.
Here we have also created two sub-tabs for Training 3 and customer. In customer, we have two fields account number and name.
Here we have one tab which is Uneditable and contains all the system-related fields like data area Id, Rec ID, table id, and partition.
To make it un-editable we select “No” in ‘Allow Edit’ in the ‘behavior’ tab of the ‘system fields’ tab.
After creating the table and form we create a method in the august training table which will run when we Select the customer account number in the development tab. And auto-fetch the Customer name from the DirParty table. For this, we need to override the validate method of the field custAcc.
The above code is invoked when we change the value of the custAcc field in the form. And will fetch the customer’s name from the dirpartytable for the corresponding account number we select from the drop-down. And then the cust account number and name are updated in the parameter table.
D365 Business Central