Make two entries into two databases on create -- how to get the ID of last submitted.

Make two entries into two databases on create -- how to get the ID of last submitted.

raisoncoraisonco Posts: 17Questions: 5Answers: 0

When I create a new entry I want to also save two fields in another database table as a reference. In my specific case they are two ID's. day_id and item_id.

How can I get the ID field of the entry last created by the Editor instance/process? So I can then add it to my reference table?

Thanks

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    What are you using on the server-side? If its the NodeJS, PHP or .NET libraries we provide for Editor, then a server-side event sounds like the perfect option for this. Specifically the postCreate event.

    Allan

  • raisoncoraisonco Posts: 17Questions: 5Answers: 0

    Hi Allan

    Sorry, I forgot I posted this and then re-posted on the account we purcahsed the editor license. (Brain haze after a lot of coding!)

    I'll link here: https://datatables.net/forums/discussion/53050/get-the-row-id-of-the-newly-created-row#latest

    Appreciate your help on this as very stuck. Thanks

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Thanks. So you are using the PHP libraries. Did you try using a postCreate event?

    Allan

  • raisoncoraisonco Posts: 17Questions: 5Answers: 0

    Thanks that worked in the end, but a bit trickier than expected because of using chained php methods. Thanks for the pointer.

This discussion has been closed.