locked
How to change the Iframe url at form onload event in ms crm 2011 RRS feed

  • Question

  • Hi All,

    I have a requirement to pass record guid to Iframe URL at form on load event in ms crm 2011. I have  an custom aspx page and suing Iframe  I am displaying it in my Account form.

    Now I need to pass the current record id to that iframe URL and I tried this below java script but I am getting error that the "set_URL" function is undefined or null . 

             

    function set_URL() 

       {
               var customerId = Xrm.Page.data.entity.getId();
              var reportUrl ="http://localhost/activityrollups/contactPage.aspx?";
            if (customerId == null)   {
                    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setVisible(false);
                   }
                 else
                  {    
                Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setSrc(reportUrl + "&id"=+ customerId);
                    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setVisible(true);
                }

      } Please correct me what  I  am doing wrong here?


    Krishn Prasad Shetty

    Wednesday, April 17, 2013 8:25 AM

Answers

  • Hello,

    This maybe because your iframe is not loaded yet

    try to use like below

    function SetURL()

    {

    if(Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary")!=null)

    {

    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setSrc(reportUrl + "&id="+ customerId);
                    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setVisible(true);

    }

    else

    { window.setInterval("SetURL()",1000);}

    }


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by HIMBAPModerator Wednesday, April 17, 2013 9:07 AM
    • Marked as answer by Shetty KP Wednesday, April 17, 2013 10:25 AM
    Wednesday, April 17, 2013 9:07 AM
    Moderator

All replies

  • Hello,

    Change this line

    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setSrc(reportUrl + "&id"=+ customerId);

    to

    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setSrc(reportUrl + "&id="+ customerId);


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, April 17, 2013 8:33 AM
    Moderator
  • Thanks for quick response .

    But no luck the error is changed to like this ,


    Krishn Prasad Shetty

    Wednesday, April 17, 2013 8:41 AM
  • Hello,

    This maybe because your iframe is not loaded yet

    try to use like below

    function SetURL()

    {

    if(Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary")!=null)

    {

    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setSrc(reportUrl + "&id="+ customerId);
                    Xrm.Page.ui.controls.get("IFRAME_ActivitySmmary").setVisible(true);

    }

    else

    { window.setInterval("SetURL()",1000);}

    }


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by HIMBAPModerator Wednesday, April 17, 2013 9:07 AM
    • Marked as answer by Shetty KP Wednesday, April 17, 2013 10:25 AM
    Wednesday, April 17, 2013 9:07 AM
    Moderator
  • Hi Recently I updated MS CRM 2011 Update roll up 12 and  I am using IE9 .Is it required to IE 10 fro UR 12 .Because  When I open Account form and click the Tab which contains the Iframe  then suddenly my IE gets restarted. Any reason for this ? 

    Krishn Prasad Shetty

    Wednesday, April 17, 2013 10:29 AM