RE: How to intercept 'Mark Complete' button click on Appointment form with javascript?
Hi,
The only form events you can intercept in javascript are onload, onsave, field on change (others are related to tabs etc). Mark Complete is not an event but a functionality on activities which does certain things and then changes the status. This functionality calls some internal JavaScript method.
With that said, the possible solution would be to use ribbon workbench, find the system method being called on Mark Complate. Replace that with you custom JavaScript method, in your custom javascript method, do you custom validation and then call the system method.
Alternatively you can hide the system Mark Complete button and create your custom Mark Complete button, within this call you javascript validation and once everything is fine, you can either use web api to marke the appoint as complete or set some field which trigger oob workflow to mark the appointment as complete.
Hope this helps.