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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.