Chapter 1: X++ Unit Test Framework
Chapter 2: Working with Data
Chapter 3: Classes
Chapter 4: Forms
Chapter 5: Visual Studio Integration
Chapter 6: Workflow
Lesson 3 : Application Substituted Kernel Classes
Application Substituted Kernel Classes
Application substituted kernel classes extend system classes whose names begin with “x”. They are listed at the bottom of the Classes node in the AOT. To indicate that the classes are special, their icons differ from those of the other application classes.
Most classes have a global variable used to access the class. The global variables do not need a variable declaration and are preinstantiated by the client.
Each class serves a different purpose. The extent to which you will need to use them vary.
When using the classes:
- Always use the application classes rather than using the system classes directly.
- Use the global variables to access the classes, when available.
- Never instantiate these classes (except for the Session class). Use the global variables listed below instead.
- Specify the application class name to access static methods.
Special X++ Global Variables
Some of the substitute application classes that extend an x system class are associated with a special X++ global variable that represents an instance of the X++ class. For example, the appl variable references a pre-instantiated object from the Application X++ class. The advantage of the appl variable is that the system maintains the object throughout the scope of your session. It would be less efficient for your X++ code to repeatedly use the new Application() syntax to obtain an instance of the Application X++ class.
You should not use the xApplication system class. Use the Application substitute application class instead. You can reference the static members of the Application X++ class by using the standard syntax Application::checkForNewBatchJobs(). But you should reference the instance members of the Application class by using its corresponding special system variable appl, if one exists. This pattern applies to most of the x system classes. The Session substitute application class is one exception to this pattern, because there is no special system variable for Session.