OpenWGA 7.0 - TMLScript reference

Design
Property :

createObject(modulename [, param1, ...paramN])
createObject(objectDef [, param1, ...paramN])

On object Design
Usage Creates a custom TMLScript object
Description

This is a variant of WGA.createObject() which is capable of creating custom TMLScript objects defined in the current design. Otherwise it works just like its pendant on the WGA object.

To create a custom TMLScript object inside another TMLScript object, where both are defined in the same design, you will need to use this variant with a design context that was constructed with the "outer" object as parameter.

Parameters modulename (String):
Variant 1: Name of the TMLScript module containing the object code.

objectDef (Function):
Variant 2: Precompiled definition object, created by Design.loadObjectDefinition()

param1...param5 (Optional):
Parameters for the TMLScript object constructor
Return value Newly created custom TMLScript object
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
    portletevent
Examples

The following code is the constructor of a custom TMLScript object. Inside this constructor another TMLScript object is created whose definition is contained in the same design. Therefor a design context based on the outer object is created and used to create the inner object:

this.init = function() {

  this.innerObject = WGA.design(this).createObject("myInnerObject");

}