Microsoft CRM Online
January 12, 2012
CRM 2011 - iFrames & Saving
After spending time on several of the CRM forums, I noticed a few people having trouble with iFrames and saving data inside of the iFrame. While a forum post is a little difficult to write a full response, I wanted to share some insight on capturing the form save event to then trigger a save event inside of your iFrame.
From a business case, this is a fantastic way to tie multiple systems together. If all you are doing is syncing data, then look first at a plugin or scribe. However, if you are looking for the user to interact with multiple systems simultaneously, then an iFrame is a wonderful way to integrated with an existing system. A good example might be where CRM is only storing the summary information and the iFrame contains the details. The user may update the details which should save both the CRM record and the details of the web site.
Prerequisites
First, let’s assume you have an iFrame inside an entity.
Secondly, we need to uncheck the “Restrict cross-frame scripting” check box on the iFrame properties.
Lastly, it’s a good idea to make sure our iFrame is using HTTPS to prevent mixed mode security warnings.
Talking Directly
If you try to talk directly to the iFrame via something like:
Xrm.Page.ui.controls.get('IFRAME_opp').getObject().contentWindow.document
Unless you are On-Premise, you may encounter the “Access is Denied” warning. This will show itself when dealing with URLs on a different domain (or subdomain). Cross domain scripting is a security feature within the browser. Now an easy fix is to disable the browser settings, but this isn’t a good solution.
Messaging
Instead of talking directly, we need send a messages to our iFrame. To send a message, we’d do something like:
Xrm.Page.ui.controls.get('IFRAME_opp').getObject().contentWindow.postMessage('test', "*")
To receive the message on the iFrame, you need to listen for the message event. Let’s take a look at the JavaScript on our example iFrame page:
1: function receiveMessage(e) {2:3: if (e.origin == 'https://way.crm.dynamics.com'){4:5: if (e.data == 'test'){6: document.getElementById('msgBox').innerHTML = 'testing...<br />' + e.origin + '<br />' + e.data;7: }8:9: if (e.data == 'save'){10: saveForm();11: }12: }13:14: }15:16: saveForm = function() {17: document.getElementById('msgBox').innerHTML = 'saving...';18: }19:20: window.attachEvent("onmessage", receiveMessage);
It is very important to check the origin and the message if you are dealing with publicly facing sites.
If the idea of messaging is new to you, here are some additional resources:
- http://msdn.microsoft.com/en-us/library/cc197015(VS.85).aspx
- http://msdn.microsoft.com/en-us/library/cc511311(v=vs.85).aspx
The OnSave
To initiate the message from the CRM 2011 form, you need to register an OnSave event from within the “Form Properties”.
How about .NET Pages?
If your iFrame is an ASPX page, all of this still applies. The only difference is that you want to have an ASP.Net button on your page to call the server side code. Instead of the saveForm event, simply call the click event of the button.
When dealing with server side saves though, you can either post a message back to say “I’m done” which will then complete the CRM save or you can put a set timeout in the onSave on the CRM side.
Conclusion
Hopefully you have seen how easy it is to integrate with another web site while inside of CRM 2011. If you have had problems with iFrames in the past, I really encourage you to use iFrames for your integration needs as they can really enhance your users experience and can allow for improved data across systems. I hope you enjoy!
Posted by Paul Way on January 12, 2012 at 01:22 PM in CRM Javascript, Dynamics CRM 2011, Microsoft CRM Customizations, Microsoft CRM Online, Microsoft CRM Tricks and Tips, XRM | Permalink | Comments (2) | TrackBack (0)
December 12, 2011
Jscript Pop-up in Microsoft Dynamics CRM - Internet Explorer vs. Outlook
Occasionally when developing custom solutions in CRM, there will be a need to open a new window from Jscript. Typically the window.open function is used to accomplish this, but this is not always ideal in CRM.
Consider developing a custom solution in CRM where you need to open another CRM record in a new window. In the web interface of CRM the window.open function works fine, but what about the Outlook integration functionality? Well, in On-Premise this doesn’t pose a big issue because Internet Explorer will typically use your logged in account to authenticate with CRM. But what if you are not using On-Premise, or what if you have another set of logins specifically for CRM in your Active Directory environment (not sure why you would, but it could happen).
Outlook allows a user to cache their credentials to allow communication with the CRM environment without having to log in every time. However, if you open a new window using the standard Jscript window.open function, it will open your window in Internet Explorer not Outlook. In situations where you have to log in to reach CRM (i.e. not using On-Premise with your standard Active Directory account), this will require the user to enter their credentials before opening the correct page. This really disrupts the flow of any process, and is annoying and confusing to end users.
Luckily, Microsoft provided a function to handle this situation (although it is undocumented). There is an openStdWin function that is a part of the CRM Jscript implementation that will check to determine if the user is using Outlook or Internet Explorer, and open the new window in the appropriate format. The following code displays the way this functions:
function openNewWindow(url) {
var name = "newWindow";
var width = 800;
var height = 600;
var newWindowFeatures = "status=1";
var oldWindowFeatures = "width=800,height=600,status=1";
// Regular Jscript function to open a new window
//window.open(url, name, oldWindowFeatures);
// CRM function to open a new window
openStdWin(url, name, width, height, newWindowFeatures);
// CRM function to open a new window
// with default CRM parameters
//openStdWin(url, name);
}
One point to note, if you simply pass the url and name to the openStdWin function and leave off the width, height, and windowFeatures, the window will be opened with the same parameters that regular CRM windows are opened with. (i.e. same width and height as a standard CRM pop-up with no address bar, but with the status bar and resizable)
Now you don’t have to worry if the user is in Outlook or Internet Explorer, your pop-up window will open correctly. Enjoy!
Notice: openStdWin is an internal function of CRM and may change at any given point without notice.
Posted by Tyler Compton on December 12, 2011 at 10:37 AM in CRM Development, Microsoft CRM for Outlook, Microsoft CRM Online | Permalink | Comments (0) | TrackBack (0)
November 14, 2011
Activating a Microsoft Dynamics CRM 2011 Online Trial
Setting up a Microsoft Dynamics CRM 2011 Online trial is easy enough to do (which is very nice) and it happens fairly quickly (usually within 15 minutes). The focus of this blog is what to do when you wantto activate the trial subscription. It will also cover steps needed to change the billing administrator and billing delegates for the CRM Online instance.
You must be the billing administrator for your CRM Online instance to be able to activate your online trial. Whoever setup the trial initially is designated as the billing administrator. See the Additional Notes area below for more details about the billing administrator and how to change it. Billing delegates can be setup and can manage the billing preferences after initial setup.
There are a couple of ways to activate your subscription. If you haven’t closed the message bar and it still appears in the CRM application window, you can simply click “Activate Now” in the gold message bar.
I have found that most people close the gold notification bar so I will explain where you can find Activation in the user interface. Click on “Settings” in the wunderbar, then click “Administration” in the left navigation, and then click “Subscription Management” on the right. The links are highlighted in the screen shot below.
At the bottom of the Subscription Management information is a button named “View Offers” In the Offer Management section.
After clicking the “View Offers” button, you will be presented with the screen below.
Click “OK” and you will be redirected to the Windows Live login page. The reason for this is you are now logging into another system for the billing information. You will be directed to the following screen which is Step 1 of the activation process.
Please read and the Subscription Terms information and check the “I accept …” check box. When complete, click the “I Accept” button. You will be brought to Step 2.
Enter your contact information and click Next. You will be brought to Step 3.
Fill in your credit card information and verify the billing address information for the credit card. Then click “Next”.
Step 4 is the confirmation page and you will have successfully activated your CRM 2011 Online subscription.
ADDITIONAL NOTES:
There are a couple of important notes you should be aware of concerning your CRM 2011 online subscription and the billing administrator setup for your account.
Billing Administrator:
There can be only one billing administrator for a CRM 2011 Online instance but there can be multiple billing delegates which can be setup later. If you are in the habit of setting up environments for your customers, this means you are the default billing administrator.
The billing administrator must be a user in CRM so please make sure that person is setup as a user before calling Microsoft to change the billing administrator for your CRM instance. Changes made to the billing administrator should take effect about 15 minutes after it is made by Microsoft. You can contact Microsoft using the phone number below.
I hope this clears some things up.
Support U.S./Canada Toll-Free
877-CRM-CHOICE
(877-276-2464)
Posted by Mark Weilandt on November 14, 2011 at 11:22 AM in Microsoft CRM Online | Permalink | Comments (0) | TrackBack (0)
October 12, 2011
Microsoft Dynamics CRM Online Security
So you are evaluating Microsoft Dynamics CRM 2011, and determining whether you should make the investment in servers and install on premises, or go to the cloud with CRM Online.
One of the top questions in your mind may be security—if we don’t install on premises, what will happen to my data?
Microsoft recently published a 15 page white paper that details the security features of CRM Online. It includes an overview of application security, but also details about the security of Microsoft’s hosted offering:
- Security for Hosted Products
- Hardening process
- Accountability
- Back-end infrastructure and network features
- Back-up
- SLA
It’s great to see Microsoft provide some transparency into what they do to help give their customers piece of mind, and that with CRM Online, your data may actually be more secure than it would be on premises.
Posted by Joel Lindstrom on October 12, 2011 at 09:35 AM in Microsoft CRM Online | Permalink | Comments (0) | TrackBack (0)




Recent Comments