Saturday, August 28, 2010

MSCRM: Automatically setting Due Date to Current Date in Activities

A client recently asked: When we are logging phone calls, is there a way to have the due date default to the current date?


You can click on the calendar in the activity and enter the date you want, but it would be easier if the “Due” field was automatically populated with the current date. In many cases, especially if you’re actually logging phone calls that you’ve already made or tasks that you’ve already completed, the current date is the correct one and all you then need to do is type in your notes and then, save, and complete.


Include the following script in the On-Load event of the phone call form to have the due date automatically populated:


var CRM_FORM_TYPE_CREATE = 1;


var CRM_FORM_TYPE_UPDATE = 2;


switch (crmForm.FormType)


{


case CRM_FORM_TYPE_CREATE:


crmForm.all.actualdurationminutes.DataValue = null;


crmForm.all.scheduledend.DataValue = new Date();


break;


case CRM_FORM_TYPE_UPDATE:

// do nothing


break;

}

No comments: