As a lot of people know it is possible to make related entities appear on the current form through an iFrame and using some JavaScript to load the grid in the form. For those of you who don’t know how this is done;
1. Create an iFrame on the entity you what to display it on.
2. Give it an appropriate name.
3. Set the URL of the iFrame to: /_static/blank.htm or about:blank.
4. Make sure that "Pass record object-type code and unique identifier as parameters" is ticked.
5. And "Restrict cross-frame scripting" is unticked
The next thing you need to do is add some JavaScript that will load the iFrame with the entity;
if (crmForm.FormType != 1) {
try {
crmForm.all.<iFrame Name>.src = GetFrameSource("<Relationship name>");
FixStylingInFrameSource('<iFrame name>');
} catch (e) { }
}
For you to use this code you only need to change 3 things;
1. Where it says <iFrame name> replace that with the name you gave the iFrame
2. And <Relationship name> replace that with the name of the relationship to the desired entity.
Now this code is all good and all but only if you can/have created a relationship for it, now if you wanted to do this for history which is a system entity which doesn’t have a relationship to entities and it is not possible for you to create a relationship to history the above code will not do what you desire. But there is a way around this;
1. Create an iFrame on the entity you what to display it on.
2. Give it an appropriate name.
3. Set the URL of the iFrame to: /_static/blank.htm or about:blank.
4. Make sure that "Pass record object-type code and unique identifier as parameters" is ticked.
5. And "Restrict cross-frame scripting" is unticked.
The next thing you need to do is add some JavaScript that will load the iFrame with the history;
function GetFrameSource(tabSet) {
if (crmForm.ObjectId != null) {
var oId = crmForm.ObjectId;
var oType = crmForm.ObjectTypeCode;
var security = crmFormSubmit.crmFormSubmitSecurity.value;
return "areas.aspx?oId=" + oId + "&oType=" + oType + "&security=" + security + "&tabSet=" + tabSet;
}
}
crmForm.all.<iFrame name>.src = GetFrameSource("<nav Id>");
There are only 2 things that you need to replace for this JavaScript to work;
1. Where it says <iFrame name> replace it with the name of the iFrame.
2. And <nav Id> replace that with the nav id of the item you want to display in the iFrame.
The results of both of these are as shown below, enjoy.