Aug 22, 2011

Difference between completing and cancelling an appointment – part 1

In some business logics, it is required occurring some steps when an Appointment is closed. When I started coding it, to trigger a JavaScript, I made it happen in “onSave” event as usual. Eventually I found that it is needed to check exactly what the mode of “close Appointment”. Actually closing is the deactivating the record as we understand in CRM terms. So I could simply check relevant mode (i.e. 5). Then only I understood that I need more checking before proceeding. Not like any other entity, Appointment has another option of cancelling while closing. See below menu;


Hm... It’s obvious that you need to do your task only when completing, not cancelling. Here, trick is, you need to check “newStatusCode” code for that. That’s how you need to distinguish two cases. Below code will explain it well;

if (event.Mode == 5) //Deactivate Mode
{
   var status = document.getElementById('newStatusCode').value;
        
   if (status == 3) //Status for Completed
   {
            
   }
   if (status == 4) //Status for Cancel
   {
            
   }
}


Hope this is easy.

Please read Part2.

No comments:

Post a Comment