on ‎2020 May 19 8:22 AM
Hello,
I am calling a function import to start a workflow in the backend. Currently I have implemented the logic in the controller.js as I need to perform different actions depending on the response. It is working fine, but is there a more elegant was to implement this function import call via the xml view?
I found a start here: Binding data from Odata function Import in SAPUI5 XML
but it does not cover the reaction to the response.
*********************** view.xml
<Button text="Start workflow" press="onStartWorkflow"/>
*********************** controller.js
onStartWorkflow : function () {
var oModel = this.getView().getModel();
oModel.callFunction(
"/startWorkflow", {
method: "GET",
urlParameters: {
task: "TSXXXXXX"
},
success: function (oData, response) {
if (response.data.state === "Started") {
MessageToast.show("Workflow" + response.wfID + "started");
} else {
MessageToast.show("workflow could not be started");
}
},
error: function (oError) {
MessageToast.show("oData call Error");
}
});
},
Request clarification before answering.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.