Form Event Handler In D365, Below is the sample code to do it.