How to automatically update the case status based on the lifecycle stage