...
Know the Name of the Service Data Object.
Code Block language js linenumbers true var getPILQuantityDataObject = "spGetProductInventoryLedgerQuantities";
Know the parameters you need and their values.
Code Block language js linenumbers true var getPILQuantityParams = { "ProductInventoryLedgerID": 1 };
Define success and error callback functions. Of course, you can define these anonymously in the actual call to executeDataObject(), but that call will be more succinct and readable if you define them separately.
Code Block language js title Define A Success Callback linenumbers true function _onGetPILQuantitySuccess(data) { // data.results contains the table produced by the Service Data Object // The table is represented as a 0-indexed array of rows. // A row is represented as a JavaScript Object with properties // that have the names of the columns returned by the Service Data Object if (data && data.results.length > 0) { // Handle each row of the table } }
Code Block language js title Define An Error Callback linenumbers true function _onGetPILQuantityError(error) { throw ({ type: "internal_error", message: "An error occurred while calling " + getPILQuantityDataObject + " Service Data Object." }); }
Call Aptify.framework.dataObjects.executeDataObject() to execute the Service Data Object.
Note Best practice is to check that Aptify Web is actually online before making the call, since the Service Data Object is executed on the server side.
Code Block language js title Execute A Service Data Object linenumbers true if (Aptify.framework.utility.online()) { Aptify.framework.dataObjects.executeDataObject({ name: getPILQuantityDataObject, parameters: getPILQuantityParams, successCallback: _onGetPILQuantitySuccess, errorCallback: _onGetPILQuantityError }); } else { // Handle offline condition }
Related
...
topics
Filter by label (Content by label) | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|