Prepare trigger logic.