modified() - Form data source field methods in D365 F&O - X++ Code

Views 55

Answer:

The modified() method is a standard method on the field of the form data source. This method is called when the value of a specific field is modified.

Example

You have a custom form with a table named TrainingMaster. The table has a field named Venue and an enum type field named TrainingType that has two values: Online and Classroom. If Online is selected for the TrainingType, the Venue field should become blank.

The coding pattern can be as follows:


[DataSource]
class TrainingMaster
    {
        [DataField]
        class TrainingType 
        {
            public void modified()
            {
                super();
                if(TrainingMaster.TrainingType == TrainingType::Online)
                    TrainingMaster.Venue = "";
            }
        }
    }

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of X++ Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.