cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture response for submitBatch for Odata V4 in SAPUI5

rohantiwari
Participant
0 Kudos
2,635

I am working on SAPUI5 project, where i am using Odata V4.

Below is my code

POST call is successful and is working fine ( it's performing required task in backend):

But i am unable to capture the response :

Accepted Solutions (0)

Answers (1)

Answers (1)

Marian_Zeis
Active Contributor

As described in the documentation "submitBatch" will return undefined:

https://ui5.sap.com/#/api/sap.ui.model.odata.v4.ODataModel%23methods/submitBatch

You can also look at the documentation how to get the result of the created context

https://ui5.sap.com/#/topic/b4f12660538147f8839b05cb03f1d478

onCreate : function () {
	var oList = this.byId("peopleList"),
		oBinding = oList.getBinding("items"),
		oContext = oBinding.create({
			"UserName" : "",
			"FirstName" : "",
			"LastName" : "",
			"Age" : "18"
		});

	this._setUIChanges();
	this.getView().getModel("appView").setProperty("/usernameEmpty", true);

	oList.getItems().some(function (oItem) {
		if (oItem.getBindingContext() === oContext) {
			oItem.focus();
			oItem.setSelected(true);
			return true;
		}
	});
},
dev3
Explorer
How to catch a error or success message after the call?
mm_uzh
Explorer
0 Kudos
I would also like to know how to get the error message after the call? patchCompleted only returns if it was successful. We can use sap/ui/core/Messaging Model. But there only general errors are logged, and not request specific.