Integrating Your Web Site into Microsoft CRM
As you can see in the code sample, GUID values are returned by some methods and also passed as parameters in the XML text. What you don't see in the code sample is the CRMLeadGUID value being stored in our database with the registration information. We added this value to our database so that we could retrieve it for a user in the event that we want to generate a CRM Activity for them for a download or information request that occurred on our Web site.
It's also likely that you'll want different users as the owner of the CRM Lead or CRM Activity depending on certain data (Product downloaded, geographical region, type of request, and so forth). As you may recall from the code sample, this is the user account used with the NetworkCredential. Storing these user names and passwords in a secure yet accessible location is important. For reasonable security and accessibility, I would recommend storing them in your Web.Config file and using the System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile() method for password storage.
Because the intent of the code sample was to demonstrate the basic schema members of the XML for CRMLead and CRMActivity objects, it's worth mentioning that CRMLead and CRMActivity objects both have dozens of elements that you can populate with information in your XML to more concisely and full define attributes of your CRMLead or CRMActivity objects. See the .xsd files for additional schema information. The more you explore the CRM SDK Documentation, you'll find how widely applicable the patterns discussed here are across the objects in the CRM class libraries.
As this article demonstrates, Microsoft CRM has a very powerful XML-based API that allows Web Services to be invoked from a variety of different application platforms. This open architecture allows for businesses of all kinds to integrate their Web sites, applications, and processes with CRM data and reduce the amount of busy work required by CRM users. With a little bit of exploration into the CRM API, there is a good chance you'll be able to find features that will allow you to automate common business practices within your organization.
About the Author
Jason Mauss is Chief Technology Officer for Knowledge Relay, Inc - a business intelligence visualization company, providing tools and resources at all levels of the enterprise. In addition to writing technical articles, he keeps a weblog at http://weblogs.asp.net/jamauss. You can contact him at Jason.Mauss@KnowledgeRelay.com or through his weblog.
Page 2 of 2