To implement Automation with C/SIDE, you create an Automation controller in C/AL code of your Microsoft Dynamics NAV 2009 object. By using variables that have an Automation data type, an Automation controller implements and run Automation objects from an Automation server. This topic outlines the procedure for creating an Automation controller.
To create an Automation controller that uses an Automation server
Declare the creatable (top-level) interface (class) of the Automation server as a variable of the Automation data type.
Declare all other objects and interfaces (classes) as variables of the Automation data type.
Use the C/AL CREATE function on the variable that you declared in step 1. Do not use the CREATE function on any other variables.
If you are creating an Automation controller for the RoleTailored client, then you use the CREATE function to specify whether to run Automation objects on the RoleTailored client or on Microsoft Dynamics NAV Server. For more information, seeand .
Use the methods and properties of the Automation server in your C/AL code.
If needed, use the CLEAR function (destroy) for the top-level object. Otherwise, it will be cleared automatically when the variable goes out of scope.
You write most of your code during step 4 by using the methods and the properties of the Automation server. The syntax and the semantics of these methods and properties are documented in the documentation for each Automation server. Using these methods and properties in C/AL does not require any new or changed syntax.
For examples of creating an Automation controller, seeand .