开发者

Using javaScript with Custom entities in MS CRM 4.0

开发者 https://www.devze.com 2023-03-13 21:20 出处:网络
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 th

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消