| Microsoft CRM
Houston (800) 892-6143 |
| Implementation & Customization |
Showing Associated
Records in an IFRAME
Date: 10/19/2007
Overview:
A
client wants to be able to view associated activities of a given entity
in an IFRAME. The following instructions allow the programmer to
complete this task in entity form design view.
1. Add an IFRAME to the
form and give it a name. Lets call this one “Case.”
Set the URL to "about:blank",
check the "Pass record object-type code and unique identifier as
parameters" option, deselect the "Restrict cross-frame scripting." Under
the formatting tab, for Row Layout, select “automatically expand to use
available space,” set the IFRAME to scroll as necessary, and uncheck the
“display border” property. Hit “OK.”
2. Now it is time to build our code. The code for the associated cases activity viewed in an IFRAME is:
if(crmForm.FormType == 1)
{
document.all.IFRAME_Case.src="about:blank";
}
else
{
var
navService;
navService=
document.all.navService;
if (navService!=
null)
{
//this optional code
hides the activity from the left navigation bar
//navService.style.display = "none";
document.all.IFRAME_Case.src="/sfa/accts/areas.aspx?oId="
+
crmForm.ObjectId +
"&oType=" + crmForm.ObjectTypeCode +
"&security=852023&tabSet=areaService";
} } In order to modify the code to use another activity, you need to know three things:
1.
The
navigation property (called navService here) In this case, navService is the name that CRM uses to identify a case (incident) within the account window. Every navigation button on the account window will have a corresponding “nav” name. It is based on the tab set area, which I will explain in subsection 3.
2.
The URL that the
original window points to
In this case, it is “/sfa/accts/areas.aspx”.
To view the URL, just open an entity such as contact and hit CTRL+N.
You can then see the URL on top of the new window. In the case of
contacts, it is “/sfa/conts/edit.aspx”. For user-defined (custom)
entities, the URL is “/userdefined/edit.aspx”
3.
The tab set area that holds the look and information of the specific
activity. In this case, the area is called “areaService”. Finding out this name lets you know what the “nav” property is. To find out the name, open the entity in a new window (CTRL+N). Then view the page source. In internet explorer(IE) 6, go to the view menu and click on “view source.” In IE 7, go to Page and select “view source”. A new notepad pops up containing the html code of the page. Go to Edit and click on “Find NEXT”. The search criterion is “loadarea”. The first one found should be in a <div> tag. The “id=’this’” is the “nav” part to be used in the code. The text next to the loadarea is the tab set area of that navigation button. Click on “find next”. You will see that each loadarea corresponds to the left navigation buttons on the main form. Keep on clicking on “find next” until you find the navigation button that you want to use. 3. Now that you have all three pieces, you can write your modified code. Go to Form Properties, select the OnLoad event and click on Edit.
Check the “Event is enabled” property, fill in your code, and press OK.
Click OK once more, save the form, and publish.
If you have any questions or problems, fill free to email me at
MRodriguez@easiintl.com |
| Training | |
| Microsoft CRM 101 | |
| Microsoft CRM for Outlook | |
| Microsoft CRM Advanced Find | |
| Microsoft CRM Reports | |
| Microsoft CRM Database | |
|
Microsoft CRM Web Services |
|
|
Microsoft CRM JavaScript |
|
|
Microsoft CRM Add-ons |
|
| Microsoft CRM Resources | |
| Microsoft CRM Callouts | |
| Microsoft CRM Workflow | |
|
|
|