Hello
I am trying to write to two other related databases when adding a new event. For example, when adding a new event for a new customer, update the customer table with a new customer name and add a link to a linkage table between the customer and said organisation.
I am able to add a new event, add the new customer to the customer table but then fail to get the ID from the new record, and then use that to run a second SQL query to update the linkage table between the customer and the organisation.
I start of with attaching a function to “beforeInsert”:
$scheduler->event->attach(“beforeInsert”, “custom_beforeInsert”);
I then run $scheduler->sql->query(‘INSERT … BLAH BLAH’); which run successfully.
What I need to do next is get the ID for that record, and then run a second INSERT query against another table using the new ID generated by the previous INSERT query.
Please can you help?
Thank you