locked
Access Iframe content in MS CRM Form using java script RRS feed

  • Question

  • Hi,

    We have an entity form in which Iframe is embedded which holds the custom aspx.page .

    My requirement is, this custom aspx page holds some content which should be pulled and update in CRM form field.

    is there any way that i can access this iframe content using java script or any ways?

    Regards,
    Siddhu

    Thursday, March 21, 2013 2:12 PM

Answers

  • Hi,

    To "talk" with IFrame inside CRM Form:

    Xrm.Page.ui.controls.get('IFRAME').getObject().contentWindow.document

    To "talk" with CRM inside IFrame:

     parent.window.Xrm.Page.getAttribute('name')

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    • Proposed as answer by Azevedo PedroMVP Thursday, March 21, 2013 2:29 PM
    • Marked as answer by Siddhu336 Thursday, April 25, 2013 2:22 PM
    Thursday, March 21, 2013 2:29 PM
  • Hi,

    Did you try like that:

    parent.window.Xrm.Page.data.entity.attributes.get("new_name").setValue("Some Value");

    This code works very well for me.

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    • Proposed as answer by Azevedo PedroMVP Monday, March 25, 2013 3:15 PM
    • Marked as answer by Siddhu336 Thursday, April 25, 2013 2:22 PM
    Monday, March 25, 2013 3:15 PM

All replies

  • Hi,

    To "talk" with IFrame inside CRM Form:

    Xrm.Page.ui.controls.get('IFRAME').getObject().contentWindow.document

    To "talk" with CRM inside IFrame:

     parent.window.Xrm.Page.getAttribute('name')

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    • Proposed as answer by Azevedo PedroMVP Thursday, March 21, 2013 2:29 PM
    • Marked as answer by Siddhu336 Thursday, April 25, 2013 2:22 PM
    Thursday, March 21, 2013 2:29 PM
  • Hi,

    Thanks for the reply,

    I have tried using the above statements in my Java script; It is able to find the iframe . But in my case , Suppose in frame if have field or label which is hidden and contains a value . I want this value to be pulled and store in some CRM field?

    Regards,

    Sv Rupesh

    Monday, March 25, 2013 1:11 PM
  • Hi,

    Did you try like that:

    parent.window.Xrm.Page.data.entity.attributes.get("new_name").setValue("Some Value");

    This code works very well for me.

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    • Proposed as answer by Azevedo PedroMVP Monday, March 25, 2013 3:15 PM
    • Marked as answer by Siddhu336 Thursday, April 25, 2013 2:22 PM
    Monday, March 25, 2013 3:15 PM