It\'s my understanding that when you call last_insert_id() it goes by connections, so you\'ll get the id of the last row inserted on the same connection where last_insert_id
You should be able to use NEW.{id column name} to refer to the last insert id (so for example NEW.id if the auto increment column is called id.)
NEW.{id column name}
NEW.id
id