record before generate template