partially implemented the trigger record function