Reopen Closed Appointment Using JavaScript in D365 CRM


When an appointment is closed in D365 CRM, the appointment is not editable. There can be a requirment when Users wish to edit the closed appointment and add some missing data. This can be achieved by adding a new button on the Appointment form.


Add a new button and use below JavaScript.

var AppointmentForm = 
        var formContext= primaryControl;
        var status= formContext.getAttribute("statecode").getValue();
        if (status==1)

To understand the status and status reason details, you can refer the Microsoft document-

Note that, you need to update both statecode and statuscode, trying to update only one will give a system error.

Conclusion: You can Activate and edit the appointment, once done user can click on Mark Complete, to close the appointment.

Share Story :