
Have you ever wanted Data in CRM, but you wanted to leverage business logic found in another system you already have in place?
With very little work, you are able to move data from a HTML Page or ASPX page in an iFrame to the main CRM form. This allows for some interesting data integration scenarios.
The scenario here is there is an internal credit application that assigned a score based upon a number of different items in other internal systems. It then posted a credit score to each account. That data needs to be imported into the CRM system, but doing a traditional data import would be difficult and time consuming. And wouldn’t allow for the end user to make changes to the form and have the reflected in the other system until you saved the record.
So we render the credit score for each account in an iFrame in CRM and have the value from the HTML Page put back on the CRM form.

Here is the original form before anything is clicked.

Here it is after clicking on the Save Credit Score and Approve Credit Buttons.
The example below contains an entire html page that can be used as an iFrame target. The example contains three methods.
The first function is taking the value from a text field and putting it back into a field new_iframeresponse on the CRM Form.
function Button1_onclick() {
var oCrmForm = parent.document.forms[0];
if (oCrmForm) {
oCrmForm.all.new_iframeresponse.DataValue = document.all["Text1"].value;
oCrmForm.Save();
}
}
The second function is toggling the selected value of a drop down field new_iframeresponsecode on the CRM Form.
function Button2_onclick() {
var oCrmForm = parent.document.forms[0];
if (oCrmForm) {
if(oCrmForm.all.new_iframeresponsecode.DataValue == 1) {
oCrmForm.all.new_iframeresponsecode.DataValue = 2;
}
else {
oCrmForm.all.new_iframeresponsecode.DataValue = 1;
}
}
}
The third function simply reloads the CRM Form.
function Button3_onclick() {
parent.window.location.reload();
}
The coolest part of this code to me is:
var oCrmForm = parent.document.forms[0];
Which is how we would address the CRM Form. So with out the variable, which would look like:
parent.document.forms[0].all.new_iframeresponse.DataValue =
As opposed to method inside the CRM Form itself:
crmForm.all.new_iframeresponse.DataValue =
So if you want to play with this yourself, you can download the attachment here and install on your DEMO box. To install:
- Create Two Field – One Called iFrameResponseCode and make it a Picklist. Add Two Items to it, Approved and Deadbeat. The second field is called iFrameResponse which is used to store the credit score.
- Copy the HTML File into the ISV directory
- Point the iFrame to the HTML File.
Enjoy!
Click Here to Download the Source Code