Extending jsdo/ABL API - Invoke? - Forum - Mobile - Progress Community

Extending jsdo/ABL API - Invoke?


Extending jsdo/ABL API - Invoke?

This question has suggested answer(s)

I think I need to use "invoke".

Is there any documentation/examples on how to call your ABL code utilizing the jsdo framework?

The requirement is simple but I cannot find anything to help me with the task.

I need to call a .p or .cls the will take 2 jsdo/dataset input/output parameters.

I would like to see a basic "Hello World" example of both the javascript and the ABL

All Replies
  • Hello Mike,

    You can call an invoke method in two ways by name or using the invoke() method.

    Calling the invoke method by name looks like the following:


    This approach is used in the following sample:


    You can use the Web Inspector in your web browser to review the code.

    In this case, you would subscribe to the AfterInvoke event to process the response.

    Using the invoke() method would look like the following:

       var promise = jsdo_orderOrderLine.invoke('MonthlySales', params);

    In this case, you would use the promise object that is returned to process the response of the request.

    See the following article in the documentation:


    The parameter to the invoke method is an object with properties for each of the parameters that you are sending to the server.

    Here is the code from the example mentioned above:


                                       pcSalesRep: salesRep,

                                       piYear: 2014


    Internally, the JSDO wraps these parameters in a request object.

    See the following link for related info:


    The declaration of the method in the ABL side looks like the following:

       @openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").

       @progress.service.resourceMapping(type="REST", operation="invoke", URI="/MonthlySales", alias="", mediaType="application/json").

       METHOD PUBLIC VOID MonthlySales(

               INPUT piYear AS INTEGER,

               INPUT pcSalesRep AS CHARACTER,

               OUTPUT TABLE ttSales ):

    The key when sending a dataset to the server using an invoke operation, that the value of the parameter that corresponds to the dataset needs to be the JSON object representing the actual dataset. This means that if you look at the JSON sent to the server, you would see the name of the dataset twice. (This also applies to a temp-table.)

    jsdo.invoke("MyMethod", {

           "myDataSet": {

               "myDataSet": {

                   "table": [{

                       "field1": "value1",

                       "field2": "value2"





    The 1st "myDataSet" is the name of the parameter. The 2nd myDataSet is listed because it is part of the dataset structure.

    Please the following thread which has information on this subject:


    Please let me know if you need additional information.

    I hope this helps,