Xrm.Page.data is null

筅森魡賤 提交于 2019-12-11 01:57:34

问题


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

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.

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

Thanks!
Jon

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

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

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.

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


回答1:


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

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

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.



来源:https://stackoverflow.com/questions/8357823/xrm-page-data-is-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!