Search code examples
javascriptdynamics-crmdynamics-crm-4crm

Check if a Dynamics CRM Activity is open or closed on the client side


I'm customizing MS Dynamics CRM 4 and I have some JScript running on the form for Phone Call, E-mail, Letter, etc. How do I check in JScript whether the Activity is open or closed? It should be really simple, but I can't seem to find it.


Solution

  • Check the form type. Here's some example code with the two cases you're interested in at the top. The others are provided for the sake of completeness.

    switch(crmForm.FormType) 
    {
        case 2: // update form; activity is open
            break;
        case 4: // disabled form; activity is closed
            break;
    
        case 0: // undefined form type, barf
            break;
        case 1: // create form
            break;
        case 3: // read only form
            break;
        case 5: // quick create form
            break;
        case 6: // bulk edit form 
            break;
        default:
            break;
    }
    

    See the "Form Properties" page in the SDK.