Skip to Content
May 19, 2020 at 07:22 AM

UI5 function import with xmView



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();
		"/startWorkflow", {
			method: "GET",
			urlParameters: {
				task: "TSXXXXXX"
			success: function (oData, response) {
				if ( === "Started") {"Workflow" + response.wfID + "started");
				} else {"workflow could not be started");
			error: function (oError) {"oData call Error");