Friday, September 12, 2008

Passing CRM Form values to an IFrame

I assume that you have already added an IFrame to the entity amd unchecked "Restrict cross-frame security" under IFrame properties > Security section

PASSING SINGLE PARAMETER TO AN IFRAME :

  • new_customfield1 - Schema name of my custom field.
  • IFRAME_Custom - Name of the IFrame.

Snippet (You may place it on OnLoad or OnChange of the CRM Form as per your requirements)

var CustomFieldValue = crmForm.all.new_customfield1.DataValue;
crmForm.all.IFRAME_Custom.src = 'http://localhost/YourURL.aspx?value='+CustomerFieldValue.

PASSING MULTIPLE PARAMETERS TO AN IFRAME :

  • new_customfield1 - Shema name of first custom field.
  • new_customfield2 - Schema name of the second custom field.
  • IFRAME_Custom - Name of the IFrame.

Snippet

var CustomField1 = crmForm.all.new_customfield1.DataValue;
var CustomField2 = crmForm.all.new_customfield2.DataValue;
crmForm.all.IFRAME_Custom.src='http://localhost/YourURL.aspx?value1='+CustomField1+'&value2=' + CustomField2;

2 comments:

  1. i tried this code , in my asp.net application i cant retrieve that value..
    here is my code in asp.net on page load

    TextBox5.Text=Request.QueryString["CustomFieldValue"];

    and also this code i tried

    string now = Request.QueryString["CustomFieldValue"];
    TextBox5.Text = now;

    plz giude me. i can get tha value.

    ReplyDelete
  2. My code is limited to JavaScript in Microsoft Dynamics CRM. It isn't a generalized command. However, I believe these links might help you.

    Pass a variable from ASP.NET to HTML via Iframe?

    Passing parameters to an ASP.NET page running in an IFRAME

    ReplyDelete