Tuesday, July 10, 2018

xClassFactory

The xClassFactory class is used by the system to create objects from classes.
One analogy of this is, a Class is a blueprint, xClassFactory is a factory and an
Object is the finished product.


The
ClassFactory class extends the xClassFactory class, and allows its methods
to be overridden.
Some of the more commonly used methods on
ClassFactory are:

formRunClass(args) - creates a FormRun object for a specific
form design, using the
formstr value in the args parameter.

createClass(classId) - creates an object from a class Id.

queryRunClass(args) - creates a QueryRun object for a specific
query design, using the
querystr value in the args parameter.

The following example demonstrates how to use
ClassFactory to create and run
the CustTable form using X++:


1. Create a new
Args object, passing in formStr(CustTable).

2. Call
ClassFactory.formRunClass() passing in the args object, and
placing returned object into a
FormRun variable.

3. Call the
init(), run() and detach() methods on the FormRun object.


1
2
3
4
5
6
7
Args args;
FormRun formRun;
args = new Args(formstr(CustTable));
formRun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.detach();

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...