11.3 Use Case: Invoking a Server-Side Script from a Client Script

Sometimes a client-side script needs to invoke a script that normally runs on the Operations Center server. In this scenario, the client might or might not need to pass information to the server-side script.

To invoke a script that normally runs on the Operations Center server:

A few examples:

// Find the "server" element.
var server = formula.Administration.findElement( 'formulaServer=Server' )

// Acknowledge an alarm.
element.perform( session, ‘Ack’, [alarm], [])

In the above example, Ack is the operation name, the first [] argument is an array of alarms, and the second[] argument would pass operation arguments if they were required.

// Call custom script-based operation to do something interesting for us.
server.perform( session, 'Do That', [], [ 'One Argument', 'Another Argument' ] )

In this last example, Do That is the operation name, the first [] argument is an array of alarms which we left as an empty array since this is not an alarm-based operation, and lastly the second[] argument are optional operation arguments that are passed as a string array. The arguments appear in the target operation as the predefined script variable args, where args[0] and args[1] correspond to One Argument and Another Argument.