You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

i have note what seems to be an error in the 

web/json/workflow/process/list&packageId=

JSON API. the problem is a follow:-
1. if the package contains two processes then the JSON result will be  as follow:-

{"total":2,"data":[{"id":"leaveApp#2#leaveApplicationProcess","packageName":"Leave App","name":"Leave Application Process","packageId":"leaveApp","label":"Leave Application Process ver 2","version":"2"},{"id":"leaveApp#2#process1","packageName":"Leave App","name":"Leave Application Process2","packageId":"leaveApp","label":"Leave Application Process2 ver 2","version":"2"}]}

and i am being able to display the two processes using the following javaScript:-

$(document).ready(function () {

    $.ajax({
        type: "GET",
        url: "http://localhost:8080/jw/web/json/workflow/process/list?j_username=kermit&hash=9449B5ABCFA9AFDA36B801351ED3DF66&loginAs=admin&packageId=leaveApp",

        dataType: "JSONP",

        success: function (result) {
            $.each(result.data, function (key, val) {
                var str = val.name + ' | Version ' + val.version;
                                $('<li/>', { text: str })
                .appendTo($('#products'));

            });        }
    }); });

While if the packageid contain only one process then the above Java script will return "undefined" for the JSON, since i think becuase there will be no data property and the returned JSON format will be as follow:-

{"total":1,"data":{"id":"crm#1#process1","packageName":"CRM","name":"Proposal Approval Process","packageId":"crm","label":"Proposal Approval Process ver 1","version":"1"}}.

So can anyone help me on how i can make my javascruipt works regardless of the number of processes OR this is a problem in the API itself?

Best Regards

  • No labels