Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Dynamics CRM Online Team Blog

This blog is focused on Microsoft Dynamics CRM Online (crm.dynamics.com).

News

  • The views expressed in this blog are those of the individual and do not necessarily represent those of Microsoft. This information is provided by way of general information only and should not be relied on without obtaining independent expert advice. These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Adding Activities to the Contact form in an iFrame

I came across the details on how to do this when reading a blog posting from Matt Wittemann a couple years back.  I still use it and thought you might be interested.  Another capability to demonstrate the flexibility of the configuration options of Microsoft Dynamics CRM Online.

 

1. Create an iFrame on the Contact form with the following properties.

clip_image002 clip_image004

2. Note the iFrame Name. The color coding will come in handy later. In this example I use IFRAME_Activities.

3. Install the Internet Explorer Developer Toolbar

4. Open a CRM contact record, copy the URL

5. Open a new IE window and enable the IE Developer toolbar

6. Paste the contact URL to load the Contact record with the IE dev toolbar enabled. Click on the toolbar icon for “Select Element by Click”
clip_image007

7. Find the Activities id by clicking on Activities from the left nav bar. Ensure to select the whole Activities area, not just the logo or the text. See outlined in blue in the screenshot below. Note the id: NavActivities from the middle window of the toolbar.
clip_image009

8. Click on the toolbar icon for “Select Element by Click” to disable it and click on Activities in the left nav bar to open the Contacts’ Activities list view in CRM. Enable the “Select Element by Click” functionality and click to the left of Filter On: Next 30 Days to select the windows highlighted in blue below.
clip_image011

9. Note the src value (areas.aspx?oId=…) from the middle window of the toolbar. In particular the part of the string after the CRM GUID starting at “&oType=2&security=…..”

10. Include the nav values and src value in the following script. The script is complete with values highlighted.

**********************************************************************************

//Render Activities in iFrame
if (crmForm.FormType != 1)
{
var navActivities;
navActivities = document.all.navActivities;
if (navActivities != null)
{
navActivities.style.display = "none";
document.all.IFRAME_Activities.src="areas.aspx?oId=" + crmForm.ObjectId +
"&oType=2&security=852023&tabSet=areaActivities";
}
else
{
alert("navActivities Not Found");
}
}

**********************************************************************************

11. Open the contact form to edit

12. Create a new tab called Address and move the current Address section to that tab
clip_image013

13. Create a new section on the General tab called Activities and show the divider. Add the IFRAME_Activities to the Activities section.
clip_image015

14. Add the previously edited jscript to the Contact form OnLoad event and Enable.
clip_image017

15. Publish your contact entity customizations.

16. Result will be the Contact form with Activities rendering in an iFrame on the form rather than appearing in the left nav bar.
clip_image019

 

Enjoy,

- Eric Boocock

Posted: Friday, June 20, 2008 4:50 PM by Eric Boocock

Comments

jakubska said:

Hi Eric,

Adding activities, addresses or subaccounts to an iframe to any form in CRM 4.0 works only partially. Have you tried to "Add existing contact" or add a "New Address" whenever you have the forms inside an iframe? It does not work and returns a javascript error "could not complete the operation due to error 80020101"... Creating new activity or creating a new subaccount works, but whenever you try to "add existing" record, i.e. CRM does not just open an appropriate edit.aspx page, you will get the abovementioned error.

Haven't you encoutered this error? You wrote that everything is working, so I would like to know whether you also got this error or you just didn't check it?

Best regards,

Kuba

# August 19, 2008 9:19 AM

Eric Boocock said:

Assuming you added the customization to the contact view as displayed above, did you save the contact record before trying to add the related records?  If not this could be the cause of your error as the contact must be created before adding related records.

# August 19, 2008 4:05 PM

katycobo@hotmail.com said:

I am try to see the activities on Iframe on contact but I cant receive any error but i cant see any activitie.

I am using CRM 4.0 in Spanish.

Any sugesstion

Thanks

# December 12, 2008 8:00 PM

u101440 said:

I've read and implemented this article on my development site and it appears to work but I cannot create any New Activities by press the New Activity button. Is the iFrame acting as a read-only conduit or should I be able to add new activities using it?

Thanx

# February 26, 2009 4:52 AM

ddevine said:

"u101440" on the Iframe properties remove the check by "restrict cross-frame scripting", publish your changes and it will work.

# February 26, 2009 6:12 PM

u101440 said:

Thanx for this. Works excellent. One last thing though, there is a small amount of padding to either side and below the iFrame (you can see this in the pictures above as well). Is there a way to remove this?

# February 27, 2009 6:47 AM

Eric Boocock said:

Thanks for your comments ddevine and u101440.  I am unaware of any way to remove the padding in the iframe.

# February 27, 2009 9:43 AM

rmartin23 said:

Hello, I have a doubt. I have to connect with another DataBase to obtain some data. This DataBase is a Web Application, so I don't know if I have to insert an iFrame in the CRM with the url or create a Web Service, because I don't the differences. I want to know the advantages y disadvantages of these.

I hope your help. Thanks.

# March 11, 2009 4:12 AM
Anonymous comments are disabled
Page view tracker