cancel
Showing results for 
Search instead for 
Did you mean: 

success message on omodel create

Former Member
0 Kudos

I am performing a create operation from my UI5 application with below code , and wanted to throw a success/failure message to users. The create operation is successful though, but the message is nt coming up for users.

Is there any additional parameters that are to be added?


Create: function(evt) {

var oModel = this.getView().getModel();

sap.ui.getCore().setModel(oModel);

var requestBody = {};

requestBody.abc = 'abc';

requestBody.cde = 'cde';

oModel.create('/EntitySet', requestBody, null, function()

{ sap.m.MessageToast.show(" Created Successfully", { duration: 2000 });  },

function() { alert('failed'); });

}

Thanks in advance

kumar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Try it with this syntax (naming the callback functions):


oModel.create("/EntitySet", oEntry, {

       success : function(oData, oResponse) {

            // Success

            sap.m.MessageToast.show(" Created Successfully" );

       }

       error : function(oError) {

            // Error

          sap.m.MessageToast.show(" Creation failed" );

       }

  });

Former Member
0 Kudos

your code seems correct.put an alert inside success function and see if its  being called.