我在CRM 2013工作,我需要设置文本框的日期并将其保存到CRM 2013数据库。
看看我的代码:
var CRMForm = document.parentWindow.parent.Xrm.Page;
var currentDateTime = new Date();
CRMForm.getAttribute( “日期”)的setValue(currentDateTime);
但我在这里得到一个例外:堆栈空间不足
答案 0 :(得分:0)
您是在处理表单还是自定义Web资源?
我很困惑,因为你收到了父表格,
var currentDateTime = new Date();
Xrm.Page.getAttribute("requestdeliveryby").setValue(currentDateTime);
这应该绰绰有余。请记住,编辑表单时需要正确注册:
属性 - >事件 - > OnLoad?查看您的示例看起来就像是在尝试从错误的表单中获取Xrm名称空间。
答案 1 :(得分:0)
自己解决方案及其如下:
var dt= CRMForm.getAttribute("date");
if(dt.getValue() != null)
{
dt.setValue(dt.getValue().setFullYear(currentDateTime.getFullYear()));
dt.setValue(dt.getValue().setDate(currentDateTime.getDate()));
dt.setValue(dt.getValue().setMonth(currentDateTime.getMonth()));
}