无法获取未定义或空引用的属性'setSrc':无法找出此错误。

时间:2015-11-18 17:59:43

标签: javascript iframe dynamics-crm-2015 webresource

我已从CRM 2011升级到CRM 2015 Online,当我打开“Contact:Information”记录时,我收到一条错误消息:无法在fiframhistory(web资源名称)获取未定义或空引用的属性'setSrc'这是我用来显示与联系人记录的GUID相关的记录的Iframe。这是代码:

function fIframeHistory() {
    var vCustomerID = Xrm.Page.data.entity.getId();
    if (vCustomerID == null) {
        Xrm.Page.getControl("IFRAME_ACTIVITY_HISTORY").setVisible(false);
        Xrm.Page.getControl("IFRAME_ACTIVITIES_OPEN").setVisible(false);
    }
    else {
        var vURL = "http://aac.phoenixcoyotes.com/coyoteshockeyllc/userdefined/areas.aspx?oId=" + vCustomerID + "&oType=2&pagemode=iframe&security=852023&tabSet=areaActivityHistory";
 //var vURL = "http://coyotescrm/coyoteshockeyllc/userdefined/areas.aspx?oId=" + vCustomerID + "&oType=2&pagemode=iframe&security=852023&tabSet=areaActivityHistory";

        Xrm.Page.ui.controls.get("IFRAME_ACTIVITY_HISTORY").setSrc(vURL);
        var vURLB = "http://aac.phoenixcoyotes.com/coyoteshockeyllc/userdefined/areas.aspx?oId=" + vCustomerID + "&oType=2&pagemode=iframe&security=852023&tabSet=areaActivities";
 //var vURLB = "http://coyotescrm/coyoteshockeyllc/userdefined/areas.aspx?oId=" + vCustomerID + "&oType=2&pagemode=iframe&security=852023&tabSet=areaActivities";

        Xrm.Page.ui.controls.get("IFRAME_ACTIVITIES_OPEN").setSrc(vURLB);
    }
};

1 个答案:

答案 0 :(得分:0)

尝试使用:

Xrm.Page.getControl("IFRAME_ACTIVITY_HISTORY").setSrc(vURL);

https://msdn.microsoft.com/en-us/library/51828fe3-f6ff-4f97-80ed-b06b3a354955#BKMK_setSrc