JSDO properties, methods, and events reference : afterInvoke event
  

afterInvoke event

Fires after a custom invocation method is called asynchronously on a JSDO and a response to the Invoke operation request is received from the server.
Synchronous invocation method calls do not cause this event to fire.
Applies to: progress.data.JSDO class
The following parameters appear in the signature of any event handler (callback) function (or functions) that you subscribe to this event:

Syntax

function ( jsdo , success , request )
jsdo
A reference to the JSDO that invoked the method. For more information, see the description of jsdo property of the request object.
success
A boolean that is true if the operation was successful. For more information, see the description of success property of the request object.
request
A reference to the request object returned after the operation completes. For more information, see the description of request object.
Application code can subscribe a callback to this event by invoking the subscribe( ) method on a JSDO instance.
Note: To subscribe a handler for this event, the subscribe( ) method requires that you pass, as a parameter, the name of the invocation method to which the event applies.

Example

The following code fragment subscribes the function, onAfterInvokeGetOrderTotalAndStatus, to handle the afterInvoke event fired on the JSDO, dataSet, for an invocation of the getOrderTotalAndStatus( ) invocation method passed the parameters specified by paramObject:
dataSet = new progress.data.JSDO( 'dsCustomerOrder' );
dataSet.subscribe( 'afterInvoke', 'getOrderTotalAndStatus',
onAfterInvokeGetOrderTotalAndStatus );

dataSet.getOrderTotalAndStatus( paramObject );
    
function onAfterInvokeGetOrderTotalAndStatus( jsdo , success , request )
    if (success) {

        var response = request.response;        
        var ordTotal = response._retVal;
        var ordStatus = response.pcStatus;
/* process successful results */
. . .
        
    }
    else {
        if (request.response && request.response._errors &&
            request.response._errors.length > 0) {

            var lenErrors = request.response._errors.length;
            for (var idxError=0; idxError < lenErrors; idxError++) {

                var errorEntry = request.response._errors[idxError];
                var errorMsg = errorEntry._errorMsg;
                var errorNum = errorEntry._errorNum;
               /* handle error */
. . .

            }
        }
    }
    
};

See also:

beforeInvoke event, invocation method, subscribe( ) method (JSDO class), unsubscribe( ) method (JSDO class)