views:

263

answers:

1

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.

+2  A: 

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.

Polshgiant
Great, that works! Thanks for your help once again.
Evgeny