✏️ Explanatory Question

initValue() - form data source methods - in D365 F&O

👁 126 Views
📘 Detailed Answer
🟢 Easy
126
Total Views
8
Related Qs
0%
Progress
💡

Answer with Explanation

The initValue() method is a standard method of a form data source. While you're inserting a new record, initValue() can help you initialize field values. This method is called when a new record is created.

Example

You have a custom form with a table named TrainingMaster. The table has a date field named TrainingDate. During the creation of a new record, the TrainingDate field should be initialized with today’s date.

The coding pattern can be as follows:


[DataSource]
class TrainingMaster
    {
        public void initValue()
        {
            super();
            TrainingMaster.TrainingDate = today();
        }
    }