Using javaScript with Custom entities in MS CRM 4.0
I have custom entity where the user is going to set a start date and i need a javacsript code that would let me set the value of another field (end 开发者_如何学Cdate) in the same form according to the specified start date. Thanks :)
in the onChange event of your start data field
var startDate = crmForm.all.proposedstart.DataValue; //substitute "proposedstart" by your entity's attribute name
if (startDate == null)
return;
var endDate = crmForm.all.proposedend.DataValue; //substitute "proposedend" by your entity's attribute name
if (endDate == null) {
endDate = new Date();
}
endDate.setDate(startDate.getDate()+5); // add 5 days to the start date
crmForm.all.proposedend.DataValue = endDate;
精彩评论