How to get newly created row id

How to get newly created row id

f.talamini@stmingegneria.euf.talamini@stmingegneria.eu Posts: 23Questions: 11Answers: 0

Hello, I need to have the id of a newly created row within a submitSuccess event routine.
It seems the json parameter does not help since the id is setted to null.
How can i do?
Thank you,
Regards,
Franco

This question has an accepted answers - jump to answer

Answers

  • Rob BrunRob Brun Posts: 56Questions: 2Answers: 14

    Hi f.talamini@stmingegneria.eu the way I achieve this is to ensure that the id is included in my http response from the server. Assuming that your Id is an Identity field, this may require you to retrieve the the record from your database after the record is created and include it in your response.

    You should be able to access the id with the json parameter on the postSubmit event once it is included in your response message.

    Is what I'm thinkin :-)

    Shay

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi Franco,

    In addition to what Shay says, can you show the JSON the server is responding with please? The ID should not be null (assuming it is an auto increment column in the database).

    Allan

  • f.talamini@stmingegneria.euf.talamini@stmingegneria.eu Posts: 23Questions: 11Answers: 0

    Thank you all.
    I've found the point:
    I was doing wrong with the idSrc property in the editor. It must be pointed to the key field with the AI property setted.

    Franco

This discussion has been closed.