Xrm.Page.data为空 [英] Xrm.Page.data is null

查看:113
本文介绍了Xrm.Page.data为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在机会实体上添加了自定义表单,并附加了一些JavaScript.

I have added a custom form on the opportunity entity and have some javascript attached to it.

我正在使用window.open和url中的formId调用表单以打开表单,并且仅用于创建机会实体.

I'm calling the form using window.open and the formId in the url to open the form and is only used to create opportunity entities.

在javascript中,我只是试图填充一些字段,但Xrm.Page.data对象始终为null.

Inside the javascript I'm simply trying to populate some fields but the Xrm.Page.data object is always null.

$(document).ready(function () {
    Xrm.Page.getAttribute("ct_testfield").setValue('test');});

谢谢!
Jon

Thanks!
Jon

更新: 显然,$(document).ready()在加载Xrm.Page.data对象之前触发.

UPDATE: Apparently $(document).ready() fires before the Xrm.Page.data object is loaded.

我改为使用表单属性"对话框将函数设置为触发"OnLoad".

I instead used the "form properties" dialog on to set my function to fire "OnLoad".

我猜想$ .ready在DOM在IFrame或它所位于的任何位置中就绪并且没有加载所有其他资源时正在触发.

I'm guessing $.ready is firing when the DOM is ready within the IFrame or whatever it lives in and not all the other resources being loaded.

希望这对其他人有帮助.

Hopefully this helps someone else.

我会在7小时内将其关闭:)

I will close this in 7hrs when I'm able :)

推荐答案

更新:显然,在加载Xrm.Page.data对象之前,将触发$(document).ready().

UPDATE: Apparently $(document).ready() fires before the Xrm.Page.data object is loaded.

我改为使用表单属性"对话框将函数设置为触发"OnLoad".

I instead used the "form properties" dialog on to set my function to fire "OnLoad".

我猜想$ .ready在DOM在IFrame或它所位于的任何位置中就绪并且没有加载所有其他资源时正在触发.

I'm guessing $.ready is firing when the DOM is ready within the IFrame or whatever it lives in and not all the other resources being loaded.

希望这对其他人有帮助.

Hopefully this helps someone else.

这篇关于Xrm.Page.data为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆