Calling Invoke Operations with the JSDO - Wiki - Mobile - Progress Community

Calling Invoke Operations with the JSDO

Calling Invoke Operations with the JSDO


Methods in a Business Entities exposed as invoke operations can be called from a JSDO instance by using the invoke() method:


invoke ( op-name [ , input-object ] ) : jQuery Promise 

jsdo.invoke( op-name, input-object).then( success-handler, error-handler );

The response of an invoke operation can be processed using the success and error handlers for the Promise.

Note: The response can also be handled by using the AfterInvoke event.

The input-object is a JavaScript object where the properties correspond to the input parameters of the method.



param1: <value param1>

param2: <value param2>



The key point here is that when the parameters correspond to a dataset or a temp-table, the value uses the structure of a dataset or a temp-table. This means that you would see name of the dataset and temp-table twice. Once as the name of the parameter as a second time as part of the value in the structure of the dataset or the temp-table.

The response of the invoke operation is handled by processing the request.response property passed as parameters to the success and error handlers. The request.response object contains properties corresponding to the output parameters. For dataset and temp-table parameters you would also observe the name of the dataset and temp-table twice.

Please notice how the "ttSales" name is listed twice in the response payload and also how it used in the sample program.

The datasets and temp-tables used in an invoke operation can use same schema as the one one for the resource as well as other schema definitions.

Sample Program

<!DOCTYPE html>
    <script src=""></script>
    <script src=""></script>
/*global progress */
var serviceURI = ""; 
var catalogURI = "";{
    serviceURI: serviceURI,
    catalogURI: catalogURI,
    authenticationModel: "anonymous"
}).done(function () {
    var jsdo = new{ name: 'OrderOrderLine' });

    jsdo.invoke("MonthlySales", {piYear: 1998, pcSalesRep: "BBB"})
        .then(function (jsdo, success, request) {
            console.log("Success: ", request.response.ttSales.ttSales);
            request.response.ttSales.ttSales.forEach(function (element) {
                    "SalesRep: " + element.SalesRep 
                    + " Month: " + element.Month 
                    + " " + "Sales: " + element.Sales);
        }, function () {
            console.log("Error while calling invoke operation.");
}).fail(function () {
    console.log("Error while creating session.");


  • Trying this code as is, got this:

    Access to XMLHttpRequest at ' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.