0

I have upgraded from CRM 2011 to CRM 2015 Online and when I open up a "Contact:Information" record I get an error saying: Unable to get property 'setSrc' of undefined or null reference at fiframhistory(name of web resource) This is for an Iframe that I am using to display records related to the GUID of a Contact record. Here is the code:

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);
    }
};
PJM
  • 45
  • 2
  • 7
  • It appears that Xrm.Page.ui.controls.get("IFRAME_ACTIVITY_HISTORY") isn't returning anything (so obviously you can't call setSrc on a null object). Can you verify that is the right name of the IFRAME? (maybe there is something appended/prepended to the name) – Joseph Duty Nov 19 '15 at 21:38

1 Answers1

0

Try using:

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

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

Paul Way
  • 1,966
  • 1
  • 13
  • 10