locked
Passing a value from Iframe to Form : CRM 2011 RRS feed

  • Question

  • Hi,

    I am using MS CRM 2011. I have a Iframe in a form and i need to pass values from Iframe to the main form.

    Can anybody let me know, how we can achieve the same.

    Thanks in Advance.

    Regards,

    Sachin
    Tuesday, July 17, 2012 1:32 PM

Answers

All replies

  • Get the values for name
    var name = parent.window.Xrm.Page.getAttribute('name').getValue();
    if you want to set the attributes
    parent.window.
    Xrm.Page.data.entity.attributes.get("name").setValue("ABC");

    Please check the following link
    http://bingsoft.wordpress.com/2010/11/18/accessing-the-parent-form-xrm-page-in-crm-2011/


    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
    Mubasher Sharif
    Check out my about.me profile!
    http://mubashersharif.blogspot.com
    Linked-In Profile
    Follow me on Twitter!




    Tuesday, July 17, 2012 1:53 PM
  • Hi,

    The same can be achieved by the following code..

    _mainWindow.parent.parent.document.all["yourschemaname"].value = "";

    _mainWindow.parent.parent.document.all["yourschemaname"].innerText = YourValue;


    If my response answered your question, please "mark the response as an answer" and also "vote as helpful". Regards, Hari. www.crm2011byhari.blogspot.com

    Wednesday, July 18, 2012 12:47 PM
  • Hi,

    Thank you both for replies. But still I could not achieve the functionality.

    e.g. I have a MS CRM 2011 form which has one field called PO. In the below form I have a Iframe which has a button. On click of this button I have set the value of PO = "Test". ( just for e.g. hard coding it )

    Can please let me know what should be the java script to be included on click of the button.

    Regards,

    Sachin

    Monday, July 30, 2012 11:42 PM
  • Then you need to write the below line of code in on click of your button

    parent.window.Xrm.Page.data.entity.attributes.get("Your_field_schema_Name").setValue("Test");

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
    Mubasher Sharif
    Check out my about.me profile!
    http://mubashersharif.blogspot.com
    Linked-In Profile
    Follow me on Twitter!

    Tuesday, July 31, 2012 6:46 AM
  • Thanks MubasherSharif.

    I did the same thing, but had missed to unchecked the Restrict cross-frame scripting property of Iframe and hence was facing error.

    Thanks everybody for all your help !!!

    Appreciated.

    Regards,

    Sachin

    Tuesday, July 31, 2012 8:46 AM