-2

I am not able to call any custom function inside the oData post success call.

onSubmit: function () { 
  var that = this; that.onInit(); 
}

oModel.create("/Entity", postData, { 
  success: function (oRetrievedResult) { 
    var that=this;
    lv_BusyDialog.close();
    var msg = 'Success!'; 
    MessageToast.show(msg);
    that.onSubmit(); 
    // This onSubmit is getting not called here. 
  }, 
  error: function (oError) { 
    /* do something */ 
    lv_BusyDialog.close();
    var msg1 = 'error'; 
    MessageToast.show(msg1);
  }
Boghyon Hoffmann
  • 15,517
  • 8
  • 61
  • 146
Oyo
  • 1
  • 3
  • Possible duplicate of [How to access the correct \`this\` inside a callback?](https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback) – Boghyon Hoffmann Nov 04 '19 at 12:15

1 Answers1

0

Your that variable is local, so you can not access it out of the onSubmit function. You can assign this to that before oModel.create line.

mkysoft
  • 4,881
  • 1
  • 18
  • 29