5.6 Getting and Setting Properties

To get any property set by the underlying management system, use either the dot notation element.property or the array notation element[property]. The array notation might be necessary if the property name itself is a reserved word of JavaScript, such as class, in, or function. For example:

js> var serverElement = formula.Administration.findElement( 'formulaServer=Server' )
js> writeln( 'Memory in use by Formula: ' + serverElement[ 'Object Heap Used Memory (KB)' ] + 'KB' )
Memory in use by Formula: 7464KB
js>

IMPORTANT:Assigning a property to an element exposed in the scripting engine might result in an actual transaction against a managed resource.

To set a property, assign a value to the right-hand portion of an assignment operation. The following example shows the two ways to denote property accessors: one using dot (.) notation and one using array notation ([]).

For example:

// Warning, this sets an arbitrary organization to have new contact information; 
// DO NOT use on a production system!
if( formula.Organizations.children.length > 0 )
{
   var someOrg = formula.Organizations.children[0]
   writeln( 'Updating: ' + someOrg )
   someOrg[ 'Contact' ] = 'Acme Support'
   someOrg.Company = 'Acme Corporation'
   someOrg.Email = 'support@acme.com'
}
else
   writeln( 'You have no organizations to set properties' )