Javascript and IFrames

I'm struggling with IFrames and JavaScript quite often. When you're working with this as well, the first thing to keep in mind is:

Deselecte the option "restrict cross site scripting" (in dutch "Het uitvoeren van scripts tussen frames beperken")

That usually saves a lot of troubles.

Furthermore, the next step is to create JavaScripts. One which I use quite often, is one which allows me to access a value in the IFrame. This is useful in onSave routines to copy data from the iframe to any of the CRM attributes. This is the code which I use:


crmForm.all.name.DataValue = crmForm.all.IFRAME_CustomIFrame.Document.formname.name.value;

In this example you do need to change the name of the attribute to which you want to save the data to (crmForm.all.name -> crmForm.all.yourSchemaName). The next modification is to change the name of the IFrame. When setting up an IFrame, you do supply a name. Change the IFRAME_CustomIFrame to IFRAME_YourIFrameName. Then on your custom html or aspx page, you do need to access the variable. That you can do by specifying the name of the form followed by the name of the attribute.

For other examples, look at the page of Jonas Deibe Playing around with iframes or Michael Höhne More JavaScript Code.



VPC CRM 4.0

Just like Microsoft has developed a VPC for CRM 3.0, they have created one for CRM 4.0 as well. Here's the link to the VPC: http://www.microsoft.com/downloads/details.aspx?FamilyID=dd939ed9-87a5-4c13-b212-a922cc02b469&DisplayLang=en



CrmDateTime conversion to DateTime

When working with CrmDateTime, you'll notice that this type does have a .value attribute, but the type of this attribute is string. There is no attribute to get the .net class DateTime out of your CrmDateTime. If you do want to use a DateTime anyway, you'd easily need to convert it. You could use any of these:


Convert.ToDateTime(crmdatetime.Value)
DateTime.Parse(crmdatetime.Value)

For more information on the CrmDateTime, look in the SDK:
http://msdn2.microsoft.com/en-us/library/aa613542.aspx



Logo Dynamics

For a presentation I needed a logo of Microsoft Dynamics. At that point I realized that I have never used an official logo for Microsoft Dynamics. Searching on the internet resulted in this page:

http://www.microsoft.com/Presspass/gallery/ms-logos.mspx?FINISH=YES

It includes logo's for most Microsoft products including Visual Studio, Office, Windows and of course Dynamics.