Skip to Content

oData submitChanges for new entry with result

hi,

i'm using the oData submitChanges method in my UI5 component.

In case of a new entry i want the result back, in particular the ID of the newly created entry.

How can i get this ID ?

My code looks like :

this.getView().getModel().submitChanges(

                          // OK

                         function(oData) {

                                       // oData undefined. Which data to get the newly created entry ID ?

                                       ....

                          },

                         // not OK

                         function() {

                                     ...

                          }

      

Any suggestions ?

gr Hans

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 14, 2015 at 07:45 AM

    Hi Hans,

    I think your syntax is wrong.

    Please try:

    oModel.submitChanges({

      success: function(oData){

      sap.m.MessageToast.show(oData.toString());

      },

      error: function(oError) { }

      });

    Best regards,

    Sebastian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 14, 2015 at 06:54 AM

    That depends on your implementation of the odata service in your gateway. If you create or change an entry, it should give you an answer with the properties of the used entry.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 14, 2015 at 07:21 AM

    * @param {function} [fnSuccess] a callback function which is called when the data has

    *             been successfully updated. The handler can have the

    *                             following parameters: oData and response.

    oData should have a new key

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 14, 2015 at 09:00 AM

    It is working now. Only for a newly created entry the oData object was filled. For an existing one not.

    Add comment
    10|10000 characters needed characters exceeded