【问题标题】:Out of stack space exception堆栈空间不足异常
【发布时间】:2014-09-24 10:24:08
【问题描述】:

我在 CRM 2013 中工作,我需要设置我的文本框的日期并将其保存到 CRM 2013 数据库。

看看我的代码:

var CRMForm = document.parentWindow.parent.Xrm.Page;

var currentDateTime = new Date();

CRMForm.getAttribute("date").setValue(currentDateTime);

但我在这里遇到一个异常:堆栈空间不足

【问题讨论】:

  • 该javascript何时执行?什么时候出现错误?
  • 您可能有一个无限循环,您的代码逻辑导致更改触发该代码再次运行。

标签: dynamics-crm-2013 xrm


【解决方案1】:

您是在处理表单还是自定义 Web 资源?

我很困惑,因为您正在获取父表单,

var currentDateTime = new Date();
Xrm.Page.getAttribute("requestdeliveryby").setValue(currentDateTime);

这应该绰绰有余了。请记住,您需要在编辑表单时正确注册:

属性->事件->OnLoad ?查看您的示例看起来您正试图从错误的表单中获取 Xrm 命名空间。

【讨论】:

    【解决方案2】:

    自己得到了解决方案,如下:

    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()));
    
    }
    

    【讨论】:

      猜你喜欢
      • 2017-04-04
      • 1970-01-01
      • 2016-07-07
      • 1970-01-01
      • 2012-10-15
      • 2015-10-03
      • 1970-01-01
      • 2015-03-31
      • 2017-11-14
      相关资源
      最近更新 更多