Sunday, 13 August 2023

From Methods

 

Forms Method

These methods are used to retrieve and validate calling parameters. Do not write any code that effects the database.

Example: Change properties of control, Like Visibility, Enable, Editable.

·       init () - These methods are used to retrieve and validate calling parameters, Change properties of control, Like Visibility, Enable, Editable

·       run ()

·       close ()

 

Forms Data Source Method

These methods are used to perform operation on database fields. And also for improving performance by clearing cache data.

Also used for Sorting, filtering and creating ranges.

Example: Set Datasource properties – AllowEdit, AllowCreate, AllowDelete.

·       Init () - These methods are used to perform operation on database fields. And also for improving performance by clearing cache data. Set Datasource properties – AllowEdit, AllowCreate, AllowDelete.

·       Executequery() – This method is frequently used for applying ranges and filters.

 

·       Active () – Updating design depending on selected records, updating other datasource queries.

·       Create() – Add supplementary rules to validate the creation. Example while creation of record open some new form to enter values.

·       Initvalue() – Assign default value

·       Validatewrite () – Validate business rules and data consistency. Example mandatory fields that are form specific.

·       Write () – Override the normal saving process with specific rules. Updating datasource in same form.

 

 

 

Form Method Calling Sequence

 

Sequence of Methods calls while opening the Form

Form --- init ()
Form --- Datasource --- init ()
Form --- run ()
Form --- Datasource --- execute Query ()
Form --- Datasource --- active ()

 

Sequence of Methods calls while closing the Form

Form --- canClose ()
Form --- close ()

 

Sequence of Methods calls while creating the record in the Form

Form --- Datasource --- create ()
Form --- Datasource --- initValue ()
Table --- initValue ()
Form --- Datasource --- active ()

 

Sequence of Method calls while saving the record in the Form

Form --- Datasource --- ValidateWrite ()
Table --- ValidateWrite ()
Form --- Datasource --- write ()
Table --- insert ()

 

Sequence of Methods calls while modifying the fields in the Form

 

Table --- validateField ()

Table --- modifiedField ()

 

 

 

 

FormRun formRun = sender.formRun() as FormRun;

You can even call custom methods
formRun.myCustomMethod();

Get the selected datasource record
TableName tableBuffer = sender.cursor();

Get datasource variable
FormDataSource salesTable = sender.formRun().dataSource(SalesTable);

 

Edit Property

salesTable_ds.object(fieldNum(SalesTable, SalesId)).allowEdit(allowEdit);

 

Get Value

salesTable_ds.object(fieldNum(SalesTable, SalesId)).getValue();

 

Set Value

            salesTable_ds.object(fieldNum(SalesTable, SalesId)).setvalue(“Pass your value”);

 

Enable/disable a control

DataSourceName_ds.object(fieldnum(Table, Field)).visible(true/false);

 

Make a control mandatory

DataSourceName_ds.object(fieldnum(Table, Field)).mandatory(true/false);

 

 

No comments:

Post a Comment

Data Entities in D365 FnO

  Data management - Data entities ·        Data entity is a conceptual abstraction and encapsulation of one of more underlying tables. ...