Monday, January 19, 2009

Plug-In Error: The request failed with http status 400: Bad Request

Mitch Milam's Microsoft Discussions


I ran into this today while installing a plug-in for a customer.  A bit of research turned up articles by Ronald and George which ultimately led me to the following KB article.

The problem lies within the fact this installation has CRM on port 81, so the URL being used internally by the plug-in is incorrect.  Here is the solution, as identified in the KB article:

Additionally, create a LocalSdkHost registry key on the Microsoft Dynamics CRM 4.0 server. To do this, follow these steps:

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the following registry subkey:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM

  3. Right-click MSCRM, click New, and then click String Value.
  4. In the Name box, type LocalSdkHost.
  5. Right-click LocalSdkHost, and then click Modify.
  6. In the Value box, type the name of the Microsoft Dynamics CRM server or the host header, and then click OK.
    Note Do not specify http:// or the port number.
  7. Locate the LocalSdkPort key at the same location. Verify that the port that is listed matches the port that is being used for the CRM Web site.
  8. If the value of the LocalSdkPort key is incorrect, right-click LocalSdkPort, and then click Modify. Type the correct port number, and then click OK.

The LocalSdkPort value was already in place and correct.  After the addition of the LocalSdkHost value, everything worked as expected.

Note: Hotfix rollup 1 was installed on the server

Friday, January 16, 2009

Dude, Where’s My Space?

Matt Cooper has a nice article on how to Identify your large attachments.


Those Zune guys make it look so easy: Zune 4 = up to 1,000 songs, while Zune 120 = up to 375 hours of video. But of course, they’re looking at average file sizes, and the “up to” acknowledges that not every song is exactly 4MB. Your business data isn’t MP3s and videos, but it’s pretty similar in that regard – it comes in different amounts. Maybe you stored just a telephone number for this contact, but a full family tree, criminal background check, and medical work-up for that one. CRM Online is similar to Zune, in that we offer “CRM 5GB” (Professional) and “CRM 20GB” (Professional Plus). Here the similarities end, I’m afraid: Zune comes in lots of colors, but CRM Online only comes in blue.

The Problem

So, you’re a Professional customer with 5GB of storage, and your notification & status page is starting to look like the screenshot below. You feel like you’re running out of space. Where’s that space going, and what can you do about it? Read on, because I’ve analyzed some reports from our datacenter, looked pretty deeply into the CRM internals, and just may be able to help you reduce your space consumption.

clip_image002

Obviously, you purchased CRM Online to store your business data (leads, contacts, accounts, orders, contracts, etc.). If you just knew how much space one lead took up, you’d know how many you could store, right? As some of you undoubtedly know, it’s not quite that simple.

<rant type=“geeky”>In computer science, and engineering in general, we know that almost anything is possible if you’re willing to make the right set of trade-offs. CRM is built on top of SQL server and a metadata-driven object model, each of which adds tons of capability, flexibility, extensibility, maintainability, and probably some other -abilities I’ve forgotten. And we want those features to give us reasonably fast response time, since a system with poor performance gets poor adoption by its potential user base. So what’s left to trade off against? Space and complexity, that’s what. For instance, to search a column in SQL quickly, we build an index. But that index itself consumes more space, and in interesting mathematical ways (read up on B-trees for some insight). Pile on the fact that our object model uses multiple physical tables, each with multiple indexes, to represent an entity and its relationships, and any predictive power you thought you had goes right out the window. You get an awesome object-relational database platform with powerful workflows and a strong security model, but you can’t tell a priori what the impact of adding 500 bytes of customer data will be on your storage size.</rant>

A Lucky Break (or, “A Nice Property of Dynamics CRM”)

Given the last paragraph, it seems hopeless that you could predict where to get major gains in space reduction, or even be able to control the growth of your business data, right? Fortunately, there’s a really nice property of CRM Online customer organizations: For most of them, the biggest use of space is one particular type of entity that’s pretty easy to measure. And it’s not core business data growing out of control. That entity is the E-mail Attachment. More on the solution later, but let’s talk for a moment about how I came to know about this happy circumstance.

How do I know? Simple, I asked our operations team to run some analysis scripts against a selection of the largest databases in the service. Those scripts gave me the space consumption of all different types of entities and system data, broken out by rows, indexes, partial pages, etc. A few manipulations in Excel later, I can say with confidence that e-mail attachments are the biggest space consumer in the largest databases on CRM Online.

A brief aside: I don’t want to scare anyone – at no point did anyone have access to any customer’s business data. Before our ops team will run scripts of this nature, we must prove to them that all we get are aggregate numbers (counts of rows, size of space consumed, etc.) and not any PII or other confidential business data. Operations team members go through special training and qualification before being allowed access to datacenter machines. PII is never allowed to leave the datacenter, and all our processes are designed around this constraint. If you want more information about how we protect your privacy at Microsoft, check out this document or feel free to e-mail me: I’m the Privacy Lead for Microsoft Dynamics CRM.

So now I’ll get into the details of the E-mail Attachment entity. Its internal name is ActivityMimeAttachment, and it specifically represents a MIME attachment to an E-mail activity. Where do these come from? Well, you can upload them when you create an E-mail record in CRM, say if you want to send a PDF to a lead. More likely, though, is that you’re using the CRM Outlook client and tracking your e-mails automatically. The Outlook client stores not only the text of the e-mail, but any attachments as well! As you know, attachments can be rather large these days: images, PDFs, engineering drawings, etc. In my screenshot below, you can see the original e-mail in Outlook on the left, with an attachment from our bug tracking system, and the corresponding E-mail activity / E-mail attachment in CRM on the right. Granted, it’s a tiny attachment, but it serves to illustrate my point. One stealthy way that e-mail attachments enter your CRM system is if people you correspond with have graphics in their signature. Every time you send or receive a CRM-tracked e-mail with such a person, a little more space gets eaten up by the graphic.

clip_image004

The Solution

How does this help us solve the problem? Well, if you can see it, you can search it – and if you can search it, you can Bulk Delete it! For various historical reasons, you can’t actually do an Advanced Find query for E-mail Attachments themselves, but it’s pretty simple to craft a query using the Regarding field on E-mails. Work through this example with me. (Some of this example will duplicate what Sharad wrote last April, but I wanted to give you an all-in-one resource for solving this particular problem. Sharad’s post was a more general introduction to the various data management facilities in CRM Online.)

First, we create an Advanced Find query that looks for all E-mails who have an E-mail Attachment whose File Size is greater than some number. In my example, I’ve chosen 3 million bytes (or roughly 3MB), but you might opt for a larger or smaller number based on your needs. The query and the results of that query in our “Dogfood” CRM server are below. You should save this view with a recognizable name.

clip_image006

clip_image008

Great, we’ve picked out the records, but how do we get rid of them? That’s a simple Bulk Delete job. Go to Settings, choose Data Management, and then Bulk Record Deletion. Choose New, and click Next. From the “Look for” dropdown, choose “E-mail”, and then you can select the Saved View you created above. But wait! Won’t that query delete ALL e-mails with big attachments? What if you have a recent e-mail that still has business value even though it’s taking up a lot of room?

Add more conditions to your Bulk Delete job. In my example, I’ve chosen to delete e-mails with big attachments that are over 3 months old. You should analyze your own business needs and determine whether age, creator, status of a related account, or some other criteria makes sense. Or, you may determine that your CRM system is not in the business of storing “big” attachments at all, and so may opt not to add another condition. Check with your business for its data retention policies, of course.

clip_image010

At any rate, click Next to see the next screen. Here you can name your job and set how often you want it to run. I’ve chosen every 30 days (since my job only deletes 3-month-old e-mails, there’s no reason to run more frequently). I run it at 9:00pm since that’s an off-peak hour both for my business and for CRM Online itself. One more Next button and a Submit button, and your Bulk Delete job will be set to run.

clip_image012

Deleting the e-mails will cascade the delete to the attachments, which will free up space. You should see your “Storage Used” indicator drop within a day after the job runs (as we have various other background jobs which examine the results of the bulk delete, defragment and compress the freed pages in SQL, etc., and some of those only run at night). One caveat: based on the way we currently calculate storage used, you may not see the drop for a few days, as slack space in the SQL database may be counted as “in use” for a time. I’ve got a feature in our next service update to change that calculation so that empty space is immediately recognized as empty. As I write this, we’re in the final stages of perf and security testing the new calculation, and I’m quite optimistic that we’ll get the green light.

Remember those top databases I talked about earlier? Assuming those orgs no longer wanted any of their big e-mail attachments, they would save on average 21% (average drop in size from 1184 MB to 939 MB). Of course YMMV since you may be using more or less space in e-mail attachments, or you may want to keep some of your attachments and not others.

Other fruitful areas you could consider:

  • Refactor your workflows. Each workflow action takes up some space as it’s expanded, processed, and completed by the workflow engine. If you’re a heavy user of workflow, take a look and see where you might be wasting space here – are you using 5 actions where 3 would suffice? Each action doesn’t take much room on its own, but if a workflow runs every time you create a contact, things can fill up fast. You could delete old System Jobs to get rid of these activities – that might be a blog entry all its own.
  • Notes take space, too. If your team uses a lot of Notes attached to entities, consider how much space those might be taking up. A page of text is roughly 1KB raw, and each annotation consumes not only its raw space but the same variety of links, indexes, etc., under the hood. Notes can be deleted by the bulk delete wizard.

Exercise left to the reader: what if you didn’t want to actively delete the big e-mails, but just create a Task for the owner of the big e-mail to take some action? I can imagine a workflow that would… you get the idea J I hope this article helps you better manage your storage in CRM Online, and that it leaves you with plenty of room to grow your business data.

Special Thanks

Special thanks to the following people for technical or business review of this article: Tommy Su, Pat Munns, Stephanie Dart, and Jim Glass.

Cheers,

Matt Cooper

Published Thursday, January 15, 2009 10:39 AM by crmblog

Update Rollup 2 for Microsoft Dynamics CRM 4.0 is available

I'm not sure if I'm happy or worried that we have another Rollup out so soon after Rollup 1. However, it is here and you can review the fixes and installation instructions here

The issues that are fixed in Update Rollup 2 for Microsoft Dynamics CRM 4.0
Update Rollup 2 is a cumulative fix that includes all the fixes for the issues that are documented in Update Rollup 1. For more information about Update Rollup 1 and about the issues that it fixes, click the following article number to view the article in the Microsoft Knowledge Base:

952858 (http://support.microsoft.com/kb/952858/ ) Update Rollup 1 is available for Microsoft Dynamics CRM 4.0

This update rollup fixes the following issues:

  • 946745 (http://support.microsoft.com/kb/946745/ ) You cannot import the customization for an entity to a new system in Microsoft Dynamics CRM

  • 947762 (http://support.microsoft.com/kb/947762/ ) A workflow that is defined to be triggered on a "Record attribute change" condition may be unexpectedly triggered even though the monitored attribute is not changed in Microsoft Dynamics CRM 4.0

  • 948987 (http://support.microsoft.com/kb/948987/ ) Error message when you import data into Microsoft Dynamics CRM 4.0 by using the Data Import Wizard or start a new data migration by using Data Migration Manager: "Mismatched data delimiter: only one delimiter was found"

  • 949069 (http://support.microsoft.com/kb/949069/ ) Multi-lookup attributes are disabled in some forms after you import some customizations in Microsoft Dynamics CRM 4.0

  • 949202 (http://support.microsoft.com/kb/949202/ ) Error message when you click a section of a chart to view some data tables in Microsoft Dynamics CRM 4.0: "The processing of FilterExpression for table 'Table0' cannot be performed"

  • 949652 (http://support.microsoft.com/kb/949652/ ) Error message when you try to import a CSV file into Microsoft Dynamics CRM 4.0: "The source data is not in the required format"

  • 949844 (http://support.microsoft.com/kb/949844/ ) The Async service stops unexpectedly or you cannot start the Async service after you import an organization from another Microsoft Dynamics CRM 4.0 deployment

  • 950207 (http://support.microsoft.com/kb/950207/ ) Error message when you try to open a campaign activity in Microsoft Dynamics CRM 4.0: "Exception of type 'System.Web.HttpUnhandledException' was thrown"

  • 950266 (http://support.microsoft.com/kb/950266/ ) You are looped in the sign-in page when you try to run the Data Migration Manager Wizard in Microsoft Dynamics CRM 4.0

  • 950307 (http://support.microsoft.com/kb/950307/ ) The go offline process does not download a user record to the local MSDE database in Microsoft Dynamics CRM 4.0

  • 950372 (http://support.microsoft.com/kb/950372/ ) You are prompted to enter your user name and password multiple times when you start Outlook, or when you click a Microsoft Dynamics CRM folder in Outlook, on a Windows Vista-based computer

  • 951432 (http://support.microsoft.com/kb/951432/ ) You cannot go online again in the Microsoft Dynamics CRM 4.0 client for Outlook with Offline Access if you switch to a different network connection while you are offline

  • 951909 (http://support.microsoft.com/kb/951909/ ) Error message when you try to import a customization to another Microsoft Dynamics CRM 4.0 server: "Invalid name prefix"

  • 952148 (http://support.microsoft.com/kb/952148/ ) Error message the first time that you try to go online after you upgrade the Microsoft Dynamics CRM 3.0 client for Outlook to the Microsoft Dynamics CRM 4.0 client for Outlook with Offline Access: "An unidentified error occurred"

  • 952322 (http://support.microsoft.com/kb/952322/ ) A workflow rule does not work as expected when you perform the workflow rule in Microsoft Dynamics CRM 4.0

  • 952599 (http://support.microsoft.com/kb/952599/ ) The label of the address field may be incorrect after you publish the customization of the Contact entity and the Account entity in Microsoft Dynamics CRM 4.0

  • 952658 (http://support.microsoft.com/kb/952658/ ) You cannot find a Knowledge Base article when you search for this article in the Microsoft Dynamics CRM 4.0 client for Outlook

  • 952680 (http://support.microsoft.com/kb/952680/ ) Error message when you try to add a contract line to a contract in Microsoft Dynamics CRM 4.0: "The requested record was not found or you do not have sufficient permissions to view it"

  • 952852 (http://support.microsoft.com/kb/952852/ ) The returned count is incorrect when you run a FetchXML query from the Microsoft Dynamics CRM 4.0 Software Development Kit

  • 952855 (http://support.microsoft.com/kb/952855/ ) A user who has the Administrative mode client access license can access custom entities unexpectedly in Microsoft Dynamics CRM 4.0

  • 953033 (http://support.microsoft.com/kb/953033/ ) Error message when you try to import data that involves a picklist attribute in Microsoft Dynamics CRM 4.0: "Transform parse data"

  • 953489 (http://support.microsoft.com/kb/953489/ ) No records are displayed when you perform a mail merge against the "All Records On Current Page" option or against the "All Records On All Pages" option in Microsoft Dynamics CRM 4.0

  • 953586 (http://support.microsoft.com/kb/953586/ ) Error message when you try to start the Async service in Microsoft Dynamics CRM 4.0: "Exception while starting async service: MSCRMAsyncService"

  • 953764 (http://support.microsoft.com/kb/953764/ ) The "Parent Downloaded" filter on a Custom entity does not work as expected in Microsoft Dynamics CRM 4.0

  • 953887 (http://support.microsoft.com/kb/953887/ ) Error message when you try to edit some properties of an imported workflow in Microsoft Dynamics CRM 4.0: "Record is unavailable"

  • 953999 (http://support.microsoft.com/kb/953999/ ) Microsoft Dynamics CRM 4.0 does not return the results if you try to export the results to an Excel worksheet after you use the Next X Days condition in the Advance Find query

  • 954227 (http://support.microsoft.com/kb/954227/ ) Error message when you run the Duplicate Detect function on data records in Microsoft Dynamics CRM 4.0: "Object required"

  • 954313 (http://support.microsoft.com/kb/954313/ ) Error message when you try to log on to the Microsoft Dynamics CRM Web site from the Microsoft Dynamics CRM 4.0 server: "Request IP Address has different address family from network address"

  • 954322 (http://support.microsoft.com/kb/954322/ ) Error message when you import some customizations to an upgraded installation of Microsoft Dynamics CRM 4.0: "Either the file could not be uploaded or Import failed"

  • 954433 (http://support.microsoft.com/kb/954433/ ) You receive an error message or you cannot select the lookup value in the Advanced Find page in Microsoft Dynamics CRM 4.0

  • 954592 (http://support.microsoft.com/kb/954592/ ) Any mappings between the Lookup property of a custom entity and the Customer property of a quote use an incorrect object type code after you create a relationship in Microsoft Dynamics CRM 4.0

  • 954640 (http://support.microsoft.com/kb/954640/ ) A folder that does not have a name appears in the Parent field when you open the Address form in Microsoft Dynamics CRM 4.0

  • 954682 (http://support.microsoft.com/kb/954682/ ) The tab sequence is not in the expected order if tabs contain large sections that include multi-row fields in Microsoft Dynamics CRM 4.0

  • 954929 (http://support.microsoft.com/kb/954929/ ) Performance is poor when you change a user from one business unit to another in Deployment Manager in Microsoft Dynamics CRM 4.0

  • 954940 (http://support.microsoft.com/kb/954940/ ) Error message when you try to delete a custom entity record in Microsoft Dynamics CRM 4.0: "An error has occurred, please contact your administrator"

  • 955006 (http://support.microsoft.com/kb/955006/ ) You cannot add a user from a parent domain to Microsoft Dynamics CRM 4.0

  • 955051 (http://support.microsoft.com/kb/955051/ ) Not all the required attributes are selected and displayed correctly when you define a new Data Map that targets the Contract entity in Microsoft Dynamics CRM 4.0

  • 955055 (http://support.microsoft.com/kb/955055/ ) Error message when you open a Mail Merge document in Microsoft Dynamics CRM 4.0: "Mail_Merge_[Number][1] is a mail merge main document. Word cannot find its data source"

  • 955058 (http://support.microsoft.com/kb/955058/ ) Performance is slow when you perform some configuration changes in Microsoft Dynamics CRM 4.0

  • 955061 (http://support.microsoft.com/kb/955061/ ) Error message when you use a Presend Callout event to retrieve the regarding object of an e-mail message in the Microsoft Dynamics CRM 4.0 client for Outlook: "Send() failed, HR = 80045f00"

  • 955064 (http://support.microsoft.com/kb/955064/ ) You cannot view created activities in the Campaign Activity form in the Microsoft Dynamics CRM 4.0 Web client

  • 955206 (http://support.microsoft.com/kb/955206/ ) A report snapshot is not created when you try to schedule a report in Microsoft Dynamics CRM 4.0

  • 955233 (http://support.microsoft.com/kb/955233/ ) You receive an error message when you save a security role in Microsoft Dynamics CRM 4.0

  • 955253 (http://support.microsoft.com/kb/955253/ ) Error message when you try to add attendees into an existing appointment in Microsoft Dynamics CRM 4.0: "You do not have enough privileges to access the Microsoft Dynamics CRM object or perform the requested operation"

  • 955418 (http://support.microsoft.com/kb/955418/ ) You cannot delete a note by using a user for which a role has no the Print permission in Microsoft Dynamics CRM 4.0

  • 955422 (http://support.microsoft.com/kb/955422/ ) Error message when you try to reopen a closed opportunity in Microsoft Dynamics CRM 4.0: "1 is not a valid status code on opportunity"

  • 955423 (http://support.microsoft.com/kb/955423/ ) Error message when you merge two accounts that are added to an inactive marketing list in Microsoft Dynamics CRM 4.0: "The merge is cancelled, contact your systems administrator and try again"

  • 955469 (http://support.microsoft.com/kb/955469/ ) You receive an error message when you try to assign an instance of an entity to another user in the Microsoft Dynamics CRM Web client or in the Microsoft Dynamics CRM 4.0 client for Outlook

  • 955482 (http://support.microsoft.com/kb/955482/ ) The "actualstart" attribute and the "actualend" attribute of the ActivityPointer entity are unexpectedly set to "Date Only" in Microsoft Dynamics CRM 4.0

  • 955487 (http://support.microsoft.com/kb/955487/ ) The line feeds are lost when you send an e-mail message by using the mail merge template in Microsoft Dynamics CRM 4.0

  • 955574 (http://support.microsoft.com/kb/955574/ ) Error message when you perform a mail merge in Microsoft Dynamics CRM 4.0: "Error 0x80041103 'Contact' entity doesn't contain attribute with Name = ''"

  • 955685 (http://support.microsoft.com/kb/955685/ ) A user who has the Assign Role privilege in a child business unit can unexpectedly assign the System Administrator role in Microsoft Dynamics CRM 4.0

  • 955750 (http://support.microsoft.com/kb/955750/ ) You can unexpectedly create a service appointment even if you do not have the privileges of the Service entity in Microsoft Dynamics CRM 4.0

  • 955833 (http://support.microsoft.com/kb/955833/ ) Error message when you try to change a logon user account in the Specify Security Account page in Microsoft Dynamics CRM 4.0: "The Microsoft CRM services account is not valid"

  • 955977 (http://support.microsoft.com/kb/955977/ ) You cannot open a custom entity record while you are offline even if you have permission to open the record in the Microsoft Dynamics CRM 4.0 client for Microsoft Office Outlook

  • 955981 (http://support.microsoft.com/kb/955981/ ) Error message when you try to open a custom view in a service calendar in Microsoft Dynamics CRM 4.0: "savedquery With Id = 407a955c-6053-dd11-858a-000bdbda0c1e Does Not Exist"

  • 956045 (http://support.microsoft.com/kb/956045/ ) Only the short date format is displayed in the "Created On" and "Last Modified On" fields in the "Properties Web page" dialog box of a record in Microsoft Dynamics CRM 4.0

  • 956079 (http://support.microsoft.com/kb/956079/ ) Only records that were changed in the past 30 days are displayed for the related record type when you create a report by using the Report Wizard in Microsoft Dynamics CRM 4.0

  • 956112 (http://support.microsoft.com/kb/956112/ ) Error messages in the Application log on the Microsoft Dynamics CRM server after you delete a quick campaign: "Deletion Service failed to clean up table=[Table_Name]"

  • 956127 (http://support.microsoft.com/kb/956127/ ) Some Outlook Synchronization entity attributes are missing in an exported customizations file from Microsoft Dynamics CRM 4.0

  • 956151 (http://support.microsoft.com/kb/956151/ ) Error message in the Service Calendar in Microsoft Dynamics CRM 4.0: "Query Builder Error"

  • 956237 (http://support.microsoft.com/kb/956237/ ) The workflow remains in a waiting state after you create a workflow rule to update the status of an opportunity in Microsoft Dynamics CRM 4.0

  • 956257 (http://support.microsoft.com/kb/956257/ ) The fiscal year start date is incorrect in Microsoft Dynamics CRM 4.0 if you are in a time zone of GMT+12 or GMT+13

  • 956282 (http://support.microsoft.com/kb/956282/ ) Error message when you use the Microsoft Dynamics CRM 4.0 SDK to develop a Custom Workflow Activity assembly: "The Key cannot be NULL"

  • 956283 (http://support.microsoft.com/kb/956283/ ) Error message when you try to edit a weekly working schedule for a user or for equipment in Microsoft Dynamics CRM 4.0: "An error has occurred and you should contact your administrator"

  • 956370 (http://support.microsoft.com/kb/956370/ ) The date in the Start Date field in a contract line is incorrect after you perform the Renew Contract action in Microsoft Dynamics CRM 4.0

  • 956445 (http://support.microsoft.com/kb/956445/ ) A record remains in the Microsoft Dynamics CRM database after you delete the record in the Microsoft Dynamics CRM 4.0 Web client

  • 956521 (http://support.microsoft.com/kb/956521/ ) Changes are not reflected if you reschedule a service activity by using the "Reschedule" button in Microsoft Dynamics CRM 4.0

  • 956537 (http://support.microsoft.com/kb/956537/ ) The attachment that is included in a mail merge template is lost during the customization import process in Microsoft Dynamics CRM 4.0

  • 956751 (http://support.microsoft.com/kb/956751/ ) A workflow is triggered two times even though you set the corresponding workflow rule to run only when the activity status is Completed in Microsoft Dynamics CRM 4.0

  • 956771 (http://support.microsoft.com/kb/956771/ ) A mail merge template is unexpectedly associated with an incorrect custom entity after you export the template into a new environment in Microsoft Dynamics CRM 4.0

  • 956852 (http://support.microsoft.com/kb/956852/ ) Error message when you run a report that uses the "StoredProcedure" command type in the Microsoft Dynamics CRM Connector for SQL Server Reporting Services: "Query execution failed for data set 'Test_MSCRM'"

  • 956859 (http://support.microsoft.com/kb/956859/ ) The Microsoft Dynamics CRM toolbar is disabled in Outlook after you lose the network connection for less than one minute

  • 957031 (http://support.microsoft.com/kb/957031/ ) Error message when you try to start Microsoft Dynamics CRM 4.0 after you upgrade the operating system to Windows Server 2008: "The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly"

  • 957057 (http://support.microsoft.com/kb/957057/ ) You cannot set the Delete behavior to "Remove Link" or to "Restrict" for a custom relationship between two custom entities in Microsoft Dynamics CRM 4.0

  • 957086 (http://support.microsoft.com/kb/957086/ ) Error message when you try to change an organizer of an appointment in Microsoft Dynamics CRM 4.0: "You cannot unshare this record. The owner of the selected record is the only one allowed to move others from the share"

  • 957225 (http://support.microsoft.com/kb/957225/ ) Microsoft Dynamics CRM 4.0 unexpectedly triggers a workflow rule when you send a quick campaign e-mail activity

  • 957270 (http://support.microsoft.com/kb/957270/ ) You can unexpectedly promote an appointment that has no specified subject even though the Subject attribute of the Appointment entity is set to Business Required in Microsoft Dynamics CRM 4.0

  • 957299 (http://support.microsoft.com/kb/957299/ ) You receive an error message when you click Set Properties on a Send E-mail step in Microsoft Dynamics CRM 4.0 Workflow Designer

  • 957305 (http://support.microsoft.com/kb/957305/ ) An unexpected error message occurs when you add products to the quotes, orders, or invoices that are created from an opportunity in Microsoft Dynamics CRM 4.0

  • 957318 (http://support.microsoft.com/kb/957318/ ) In the Service Calendar in Microsoft Dynamics CRM 4.0, you can view records for the users and for the equipment that you do not have access to through your security role

  • 957377 (http://support.microsoft.com/kb/957377/ ) Localized views contain an invalid layoutXML element after you upgrade the Norwegian version of Microsoft Dynamics CRM 3.0 to the Norwegian version of Microsoft Dynamics CRM 4.0

  • 957380 (http://support.microsoft.com/kb/957380/ ) You cannot set the statuscode attribute by using the CompoundCreate process before you create the invoice in Microsoft Dynamics CRM 4.0

  • 957406 (http://support.microsoft.com/kb/957406/ ) Error message when you try to create an appointment by using the Contact form in Microsoft Dynamics CRM 4.0: "At least one recipient does not have an e-mail address or is marked as "Do Not Allow" e-mail"

  • 957421 (http://support.microsoft.com/kb/957421/ ) Outlook may crash when you synchronize Outlook with the Microsoft Dynamics CRM 4.0 client for Outlook

  • 957589 (http://support.microsoft.com/kb/957589/ ) Error message when you try to edit some columns of the workflow entity views by using the Advanced Find feature in Microsoft Dynamics CRM 4.0: "Microsoft Dynamics CRM has encountered an error"

  • 957704 (http://support.microsoft.com/kb/957704/ ) No users are found when you search for some system users by using their last names from a relationship in Microsoft Dynamics CRM 4.0

  • 957788 (http://support.microsoft.com/kb/957788/ ) Error message when you try to open an activity that is based on an ActivityPointer entity in a custom report in Microsoft Dynamics CRM 4.0: "4200 is not a recognized Object type"

  • 957919 (http://support.microsoft.com/kb/957919/ ) You receive the incorrect error message when you create the same invoice again in Microsoft Dynamics CRM 4.0

  • 957920 (http://support.microsoft.com/kb/957920/ ) No e-mail message is sent after you complete the Create Quick Campaign Wizard in Microsoft Dynamics CRM 4.0

  • 957960 (http://support.microsoft.com/kb/957960/ ) You cannot go online after you send an e-mail message to another user in Microsoft Dynamics CRM 4.0 client for Microsoft Office Outlook

  • 957970 (http://support.microsoft.com/kb/957970/ ) Tabs may disappear when you click between the tabs of some entity forms in Microsoft Dynamics CRM 4.0 and the desktop

  • 957975 (http://support.microsoft.com/kb/957975/ ) Microsoft Dynamics CRM 4.0 processes a decimal value incorrectly when you run a workflow

  • 958003 (http://support.microsoft.com/kb/958003/ ) Error message when you publish an imported workflow in Microsoft Dynamics CRM 4.0: "Automatic workflow cannot be published if no activation parameters have been specified"

  • 958031 (http://support.microsoft.com/kb/958031/ ) Error message when you go online in the Microsoft Dynamics CRM 4.0 client for Outlook over a low-bandwidth network or a high-latency network: "An unknown error has occurred"

  • 958072 (http://support.microsoft.com/kb/958072/ ) You cannot use some user queries that run against contacts, leads, or accounts after you upgrade from Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0

  • 958181 (http://support.microsoft.com/kb/958181/ ) Error message when you import an organization in Microsoft Dynamics CRM 4.0: "The type or namespace name 'InvokeDotNetAssembly' does not exist in the namespace 'Microsoft.Crm.Workflow'"

  • 958256 (http://support.microsoft.com/kb/958256/ ) The Parent Customer field is not populated on the contact record after you convert a lead to an account record and to a contact record in Microsoft Dynamics CRM 4.0

  • 958280 (http://support.microsoft.com/kb/958280/ ) Error message when you try to save a recurring weekly schedule in Microsoft Dynamics CRM 4.0: "Value was either too large or too small for an Int32"

  • 958287 (http://support.microsoft.com/kb/958287/ ) Error message when you view an activity form in Microsoft Dynamics CRM 4.0: "Exception of type 'System.Web.HttpUnhandledException' was thrown"

  • 958363 (http://support.microsoft.com/kb/958363/ ) You cannot upgrade some saved queries from Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0

  • 958487 (http://support.microsoft.com/kb/958487/ ) Error message when the administrator bulk reassigns records from one user to another user in Microsoft Dynamics CRM 4.0: "Only published workflows and workflow templates can be unpublished"

  • 958563 (http://support.microsoft.com/kb/958563/ ) The contents of the body of an e-mail message are not displayed when you view the properties for a step that refers to an e-mail message in a workflow in Microsoft Dynamics CRM 4.0

  • 958791 (http://support.microsoft.com/kb/958791/ ) Error message when you try to add a user from a trusted domain to Microsoft Dynamics CRM 4.0: "An error has occurred"

  • 958836 (http://support.microsoft.com/kb/958836/ ) Error message when you run a custom report in Microsoft Dynamics CRM 4.0: "An error has occurred"

  • 958902 (http://support.microsoft.com/kb/958902/ ) The tabs are truncated or invisible when you add notes to an entity form in Microsoft Dynamics CRM 4.0

  • 959208 (http://support.microsoft.com/kb/959208/ ) The duplicate detection job does not detect all duplicates in Microsoft Dynamics CRM 4.0

  • 959226 (http://support.microsoft.com/kb/959226/ ) Error message when you import an organization into Microsoft Dynamics CRM 4.0: "Changing the report parameters or data sources to the values you specified is not allowed"

  • 959248 (http://support.microsoft.com/kb/959248/ ) Microsoft Dynamics CRM 4.0 slows to unacceptable levels when you process e-mail messages by using the Microsoft Dynamics CRM E-mail Router

  • 959394 (http://support.microsoft.com/kb/959394/ ) An incorrect record is opened when you double-click a record in Microsoft Dynamics CRM 4.0

  • 959572 (http://support.microsoft.com/kb/959572/ ) The "Source Campaign" field on an opportunity is not populated when you convert a campaign response in Microsoft Dynamics CRM 4.0

  • 960249 (http://support.microsoft.com/kb/960249/ ) Error message when you try to run the Data Import function to import some data in the Traditional Chinese (CHT) version of Microsoft Dynamics CRM 4.0: "CrmSoapExtension detected non-CrmException"

  • 960286 (http://support.microsoft.com/kb/960286/ ) A new update is available for the time zone and daylight saving time changes in Microsoft Dynamics CRM 4.0 and in the Microsoft Dynamics CRM 4.0 client for Microsoft Office Outlook

This update rollup fixes the following issues that were not previously documented in a Microsoft Knowledge Base article:
  • If you add users from an Outgoing forest trusted domain, you receive the following error message:

    AuthenticationException: Logon failure: unknown user name or bad password.

  • If BulkDeleteIndependent_ tables are created and if the dbo user account is not the owner of these tables, the database size increases.
  • If you enter custom attributes by using the Mail Merge process, the activities that are created by the Mail Merge process may lose the values for the custom attributes.
  • When you synchronize Microsoft Office Outlook with Microsoft Dynamics CRM 4.0, the attendee response tracking of an Outlook appointment is broken. This issue occurs in Microsoft Office Outlook 2003 and in Microsoft Office Outlook 2007.
  • After you apply update 959209, you cannot publish XAML workflows. For more information about update 959209, click the following article number to view the article in the Microsoft Knowledge Base:

    959209 (http://support.microsoft.com/kb/959209/ ) An update for the .NET Framework 3.5 Service Pack 1 is available

  • When you use impersonation in an Internet-Facing Deployment (IFD) environment, you receive the following error message:

    0x80040204 Invalid user auth.

  • When you try to import a Data Map of the Customer Relationship type, you receive the following error message:

    Unmapped required columns: 1

  • When you run a report as a user who is disabled in another organization, you receive the following error message:

    Error Number: 0x80040225
    Error Message: The specified user is either disabled or is not a member of any business unit.

  • When you go offline in the German version of the Microsoft Dynamics CRM client for Outlook, you receive the following error message:

    0x80044150
    Generic SQL error

  • Notification tables do not have useful indexes that can improve performance.
  • The related entity data is not returned when you perform an Advanced Find query for Activity entities. Examples of Activity entities are as follows:
    • The Appointment entity
    • The E-Mail entity
    • The Fax entity
    • The Phone call entity
  • Reports that use the FilteredActivityPointer view return incorrect statuscode values.
  • Serializable connections are not reset to the Read Committed isolation level. Therefore, when a transaction is committed, you may encounter locks in Microsoft SQL Server.
  • When you click Set Properties in a workflow on a custom workflow activity, static text is deleted.
  • Microsoft Dynamics CRM 4.0 cannot load custom pages that reference assemblies. This issue occurs if the assemblies are deployed to the following folder:

    <crmwebroot>\ISV\<app>\bin

  • When you edit the IF condition in a workflow in the Brazilian version of Microsoft Dynamics CRM 4.0, the date format is changed from dd/mm/yyyy to mm/dd/yyyy. This issue occurs if you open the IF condition.
  • When you run a saved query from a grid and then you click Mail Merge, the data that is included in the data source is not filtered based on the filters for the saved query.
  • You cannot register a plug-in on the Create message for the CustomerOpportunityRole entity.

 

Hotfixes and updates that you have to enable or configure manually
Update Rollup 2 for Microsoft Dynamics CRM 4.0 contains the following hotfixes and updates that you have to enable or configure manually. To enable or configure these hotfixes on the server that is running Microsoft CRM 4.0, follow the instructions in the following Microsoft Knowledge Base articles:
  • 955138 (http://support.microsoft.com/kb/955138/ ) You experience slow performance or timeouts when you try to access some views in Microsoft Dynamics CRM 4.0

  • 955452 (http://support.microsoft.com/kb/955452/ ) Line feeds are not used when you send an e-mail message that uses an e-mail template to render data that has line feeds in Microsoft Dynamics CRM 4.0

  • 955745 (http://support.microsoft.com/kb/955745/ ) Error message when you try to configure the Microsoft Dynamics CRM 4.0 client for Outlook: "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms"

  • 956527 (http://support.microsoft.com/kb/956527/ ) The Microsoft Dynamics CRM client for Outlook consumes three times as much memory in version 4.0 as in version 3.0

Thursday, January 15, 2009

Trust for Delegation in List Web Part for Microsoft Dynamics CRM 4.0

Suraj Supekar wrote this


This article pertains to Trust for Delegation issues encountered in on-premise installations of Microsoft Dynamics CRM 4.0 (MS CRM) when CRM server and SharePoint Server exist on different physical machines. If you have List Web Part (LWP) deployed for IFD version of MS CRM, or both Microsoft Dynamics CRM and SharePoint Server are on same machine then your deployment is not affected by the trust for delegations issue.

In scenarios, where MS CRM on-premise and SharePoint are setup on separate machines, Microsoft Dynamics users of LWP face issues during authentication. If the SharePoint Server is not setup for Trust for Delegation then the user's Active Directory credentials are not passed to the MS CRM server. The LWP deployed on SharePoint does not receive the CRM authentication ticket from SharePoint and displays the sign on form used with an IFD installation. The screen below shows the configuration pane of LWP and sign on form. This form appears when a Trust For Delegation ( also known as Double-Hop impersonation ) is not present.

clip_image002

Figure 1 : IFD login from configuration pane

What is Double Hop issue?

In situations where SharePoint Server and MS CRM server are on different machines, the first hop is from the LWP user’s IE browser to the SharePoint server, and then from the SharePoint server to the MS CRM Server. This is the second hop. Windows credentials cannot be passed in second hop, due to security issues. To enable the SharePoint Server to pass the user credentials, the SharePoint server must be configured for Trust for Delegation.

Setting up 'Trust for Delegation'

To make it easier to understand the configuration settings, consider the following topology:

  • Machine #1 Active Directory
  • Machine #2 SQL Server
  • Machine #3 Microsoft Dynamics CRM 4.0 Server
  • Machine #4 Windows SharePoint Services 3.0/Microsoft Office SharePoint Server 2007
  • Machine #5 User accessing SP using IE

clip_image004

Figure 2: Independent CRM and SharePoint Server topology

1. First, configure IIS and IE for delegation using the steps in following KB Article http://support.microsoft.com/default.aspx?scid=kb;en-us;810572

Note: To perform remaining steps , the user must be a member of the Domain Adminstrators group or the Enterprise Adminstrators group in Active Directory, or user must have been delegated the appropriate authority.

As a security best practice, consider using Run as to perform this procedure.

2. Click Start >> Control Panel >> Administrative Tools >> Active Directory Users and Computers.

3. In the console tree, click Computers.

4. In the details pane, right-click the computer you want to trust for delegation and then click Properties. In our case its Windows SharePoint Services 3.0 server or MOSS 2007 server (machine # 4 in figure 2) .

5. On the Delegation tab, click Trust this computer for delegation to specified services only.

clip_image005

Figure 3 : Trust for delegation to specific service

6. Depending upon the IIS authentication type in WSS/MOSS Web application, do one of the following:

  • If IIS authentication type is NTLM , Click Use any authentication protocol .

OR

  • If IIS authentication Setting is Integrated Windows authentication with Negotiate (Kerberos), click Use Kerberos only ( see figure 7 ).

7. Click Add and, in Add Services, click Users and Computers.

8. In Enter the object names to select (examples), type the name of the computer that the computer will be trusted to delegate for example, Dynamics CRM 4.0 computer (Server no 3 in figure 2) , and then click OK.

clip_image007

Figure 4 : Select User and Computers

If the machine name does not resolve, Click Advanced

      • After opening Select Users or Computer dialog , click Find Now
      • Select CRM server computer from list and then click OK. In Select Users or Computer dialog , CRM server machine name will appear, Click OK.

clip_image009

Figure 5 : Select User and Computers using advanced dialog

9. In Add Services, click the Http service that will be trusted for delegation and click OK.

clip_image010

Figure 6 : Set trust for specified service

Notes

  • If you cannot see the Delegation tab as shown in Figure 3, do one or both of the following:
    • Register a Service Principal Name (SPN) for the computer account using the Setspn utility in the support tools that are on your CD. Delegation is only intended to be used by service accounts, which should have registered SPNs, as opposed to a regular user account which typically does not have SPNs.
    • Raise the functional level of your domain to Windows Server 2003 .
  • Constrained delegation, delegation of authentication for only specified services, can only be enabled on a member of the Windows Server 2003 family.

The following steps are necessary if you want to use Kerberos in WSS/MOSS.

10. In SharePoint Central administrator site, In Application Management, Select Authentication Providers

11. In Authentication Provider select Window Membership Provider from default zone and Check IIS Authentication Settings.

a. Integrated Windows authentication check box should be selected

b. Select Negotiate (Kerberos) option

clip_image012

Figure 7 : SharePoint Central Admin - Edit Authentication

You should now be able to login to List Web Part and view the configuration page.

clip_image014

Figure 8 : Successful Login in List Web Part

Cheers,

Suraj Supekar

Tuesday, January 13, 2009

AJAX, JScript and Microsoft CRM

I was looking around for a demo of AJAX and CRM and found this article on Microsoft Dynamics CRM @ Joris Kalz's WebLog. The Full article with interesting comments can be found here.


Hello JScript friends,

I'm back from vacation and back again to enjoy some interesting jscript stuff with you. Do you like JScript? I do not! However, since Web 2.0 and AJAX, it has become very popular because it makes web applications much more user friendly. And you could use jscript even for extending the client side behaviour of Microsoft Dynamics CRM. That is one more reason to use the good old trial-and-error script language. Especially AJAX techniques will help you to add validation logic on the client side of Microsoft CRM.

So what is AJAX? The magic word AJAX (Asynchronous Javascript and XML) is a web development technique for creating rich and interactive web applications, where additional data is loaded and displayed after the page is already loaded in the browser. The motivation for this technique is to make web apps more user friendly by minimizing the numbers of manual page loads and roundtrips between server and client.  AJAX has become a buzz word in 2005 but the technique is not very new. The first time I saw it was in the Navision User Portal years ago, a web based application to access the Navision ERP-System.

In this post I would like to show you how you could use AJAX-techniques together with Microsoft CRM to implement the following functionality:

1. Creating auto suggestion fields for Microsoft CRM
2. Load the data for the auto suggestion list via a web service.

Just take a look at the screenshots and you will understand what I mean. This is just a simple functionality/function but you can use this technique in many other scenarios. E.g. server side validations without a roundtrip or having a central list without using picklists.

1. Creating auto suggestion fields for Microsoft CRM

Lets start: just copy the following function into the onload event of any entity.

// Function for adding suggestion functionality
// for text input fields in Microsoft CRM
// textfield: document.getElementById('address1_country')
// method: a function, that returns an array of strings 
// preload: true or false
function SuggestionTextBox(textfield, method, preload)
{  
// max items in the suggestion box
   
var maxItems = 6;
    
    this
.suggestionList = new Array();
    this
.suggestionListDisplayed = new Array();
    
  
    var
actual_textfield = textfield;
    var
actual_value = '';
    
    var
selectedNumber = 0;
    var
countMatches = 0;
    
    if
(preload)
    {
       
// load the data via external method
       
this.suggestionList = method();
   
}
    
   
// attach this function to the textfield
   
textfield.attachEvent("onfocus", initTextfield);
 
   
// init textfield and attach necessary events
   
function initTextfield()
    {
       
// when leaving the field we have to clear our site    
       
textfield.attachEvent("onblur", resetTextfield);
        document
.attachEvent("onkeydown", keyDown);
   
}

   
function resetTextfield(e)
    {
       
//when leaving the field, we have to remove all attached events
       
document.detachEvent("onkeydown", keyDown);
       
textfield.detachEvent("onblur",resetTextfield);
   
}

   
function keyDown(e)
    {
        keyCode
= e.keyCode;
        

        switch
(keyCode)
        {
           
case 9: case 13:
               
// enter & tab key
               
if (countMatches > 0)
                {
                   
                    
                    actual_textfield.
value = suggestionListDisplayed[selectedNumber];
                    
                    if
(document.getElementById('suggestion_table') != null)
                    { 
                      
document.body.removeChild(document.getElementById('suggestion_table'));
                   
} 
                    
                }
                
                
               
break;
            case
38:
               
//pressing up key
               
if(selectedNumber > 0 && countMatches > 0)
                {
                    selectedNumber--
;
                   
createSuggestionTable();
               
}
                
               
return false;
                break;
            case
40:
               
// pressing down key
               
if(selectedNumber < countMatches-1 && countMatches > 0 && selectedNumber < maxItems)
                {
                    selectedNumber++
;
                      
createSuggestionTable();
               
}
                
               
return false;
                break;                
            default
:
               
// do not call the function to often
               
setTimeout(
                           
function()
                            {
                                executeSuggestion(keyCode)
                            }, 
200 /* in ms */
                          
);
                break;
       
}
    }

   
function executeSuggestion(keyCode)
    {
        selectedNumber
= 0;
       
countMatches = 0;
        
       
actual_value = textfield.value;
       
//todo add keyCode
        
    
        // get all possible values from the suggestionList
        
       
if (!preload)
        {
           
// load the data via external method
            // todo add some caching function
           
this.suggestionList = method();
       
}
        
       
// using regular expressions to match it against the suggestion list
       
var re = new RegExp(actual_value, "i");
        
       
//if you want to search only from the beginning
        //var re = new RegExp("^" + actual_value, "i");
                
       
countMatches = 0;
        this
.suggestionListDisplayed = new Array();
        
       
// test each item against the RE pattern
       
for (i = 0; i < this.suggestionList.length; i++)
        {
           
// if it matche add it to suggestionListDisplayed array
           
if (re.test(this.suggestionList[i]) && actual_value != '')
            {
               
this.suggestionListDisplayed[countMatches] = this.suggestionList[i];
               
countMatches++;
                
               
// if there are more values than in maxItems, just break
               
if (maxItems == countMatches)
                   
break;
           
}
        }
        
       
if (countMatches > 0)
        {
            createSuggestionTable()
;
       
}
       
else
       
{
           
if (document.getElementById('suggestion_table'))
            { 
               
document.body.removeChild(document.getElementById('suggestion_table'));
           
} 
        }
    }
    
   
   
function createSuggestionTable()
    {
        
       
if (document.getElementById('suggestion_table'))
        { 
           
document.body.removeChild(document.getElementById('suggestion_table'));
       
} 
        
       
// creating a table object which holds the suggesions
       
table = document.createElement('table');
       
table.id = 'suggestion_table';
        
       
table.width = actual_textfield.style.width;
       
table.style.position= 'absolute';
       
table.style.zIndex = '100000';

       
table.cellSpacing = '1px';
       
table.cellPadding = '2px';


       
topValue = 0;
       
objTop = actual_textfield;
        while
(objTop)
        {
            topValue +
= objTop.offsetTop;
           
objTop = objTop.offsetParent;
       
}
        
        table.style.top
= eval(topValue + actual_textfield.offsetHeight) + "px";

       
leftValue = 0;
       
objLeft = actual_textfield
       
while(objLeft)
        {
            leftValue +
= objLeft.offsetLeft;
           
objLeft = objLeft.offsetParent;
       
}

        table.style.left
= leftValue + "px";
        
       
table.style.backgroundColor = '#FFFFFF';
       
table.style.border = "solid 1px #7F9DB9";
       
table.style.borderTop = "none";
        
        document
.body.appendChild(table);
        
       
// iterate list to create the table rows        
       
for ( i = 0; i < this.suggestionListDisplayed.length; i++)
        {
                row
= table.insertRow(-1);
                
               
row.id = 'suggestion_row' + (i);
               
column = row.insertCell(-1);
               
column.id = 'suggestion_column' + (i);
                
                
                if
(selectedNumber == i)
                {
                    column.style.color
= '#ffffff';
                   
column.style.backgroundColor = '#316AC5';
               
}
               
else
               
{
                    column.style.color
= '#000000';
                   
column.style.backgroundColor = '#ffffff';
               
}
                
                column.style.fontFamily
= 'Tahoma';
               
column.style.fontSize = '11px';
               
column.innerHTML = this.suggestionListDisplayed[i];
                
       
}
    }
    
   
// return object
   
return this;
}

Next, we have to call the function for every textfield where we want to add this behavior.

var f = function ListOfCountries()
    {
       
return new Array('Afghanistan','Albania','Algeria','American Samoa','Andorra','Angola','Anguilla','Antigua and Barbuda','Argentina','Armenia','Aruba','Australia','Austria','Azerbaijan','Bahamas','Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bermuda','Bhutan','Bolivia','Bosnia-Herzegovina','Botswana','Bouvet Island','Brazil','Brunei','Bulgaria','Burkina Faso','Burundi','Cambodia','Cameroon','Canada','Cape Verde','Cayman Islands','Central African Republic','Chad','Chile','China','Christmas Island','Cocos (Keeling) Islands','Colombia','Comoros','Conch Republic','Congo, Democratic Republic of the (Zaire)','Congo, Republic of','Cook Islands','Costa Rica','Croatia','Cuba','Cyprus','Czech Republic','Denmark','Djibouti','Dominica','Dominican Republic','Ecuador','Egypt','El Salvador','Equatorial Guinea','Eritrea','Estonia','Ethiopia','Falkland Islands','Faroe Islands','Fiji','Finland','France','French Guiana','Gabon','Gambia','Georgia','Germany','Ghana','Gibraltar','Greece','Greenland','Grenada','Guadeloupe (French)','Guam (USA)','Guatemala','Guinea','Guinea Bissau','Guyana','Haiti','Holy See','Honduras','Hong Kong','Hungary','Iceland','India','Indonesia','Iran','Iraq','Ireland','Israel','Italy','Ivory Coast (Cote D`Ivoire)','Jamaica','Japan','Jordan','Kazakhstan','Kenya','Kiribati','Kuwait','Kyrgyzstan','Laos','Latvia','Lebanon','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Luxembourg','Macau','Macedonia','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Marshall Islands','Martinique (French)','Mauritania','Mauritius','Mayotte','Mexico','Micronesia','Moldova','Monaco','Mongolia','Montserrat','Morocco','Mozambique','Myanmar','Namibia','Nauru','Nepal','Netherlands','Netherlands Antilles','New Caledonia (French)','New Zealand','Nicaragua','Niger','Nigeria','Niue','Norfolk Island','North Korea','Northern Mariana Islands','Norway','Oman','Pakistan','Palau','Panama','Papua New Guinea','Paraguay','Peru','Philippines','Pitcairn Island','Poland','Polynesia (French)','Portugal','Puerto Rico','Qatar','Reunion','Romania','Russia','Rwanda','Saint Helena','Saint Kitts and Nevis','Saint Lucia','Saint Pierre and Miquelon','Saint Vincent and Grenadines','Samoa','San Marino','Sao Tome and Principe','Saudi Arabia','Schengen countries','Senegal','Serbia and Montenegro','Seychelles','Sierra Leone','Singapore','Slovakia','Slovenia','Solomon Islands','Somalia','South Africa','South Korea','Spain','Sri Lanka','Sudan','Suriname','Svalbard and Jan Mayen Islands','Swaziland','Sweden','Switzerland','Syria','Taiwan','Tajikistan','Tanzania','Thailand','Timor-Leste (East Timor)','Togo','Tokelau','Tonga','Trinidad and Tobago','Tunisia','Turkey','Turkmenistan','Turks and Caicos Islands','Tuvalu','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States','Uruguay','Uzbekistan','Vanuatu','Venezuela','Vietnam','Virgin Islands','Wallis and Futuna Islands','Yemen','Zambia','Zimbabwe');
   
}
    
var obj = SuggestionTextBox(document.getElementById('address1_country'), f, true);

 

We will call the function "SuggestionTextBox" and passing three parameter:

  1. The textbox we would like to extend in this case 'address1_country'
  2. A function which returns an array of strings, in this case f, which returns a list of countries
  3. The last parameter controls if the list of values will be loaded just one time or if false, everytime the user is pressing a key. So for long lists the second option might be better. So if true, the list should contain all possible values and if false it should contain only the result for the given input of the textbox.

For demoing purpuses I just created the function 'f', which returns some countries. So copying the above code into the onload event handler of the entity. Thats it, just save your form and publish your changes. Now you can open the form and by typing the first character the auto suggestion box will appear.

2. Load the data for the auto suggestion list via a web service.

Now that we have a great suggestion functionality we can now start to make the list a little bit more dynamic. So instead of fixed function which returns static list of items, we could load them every time by using a web service.

Web Service function, which returns a list of values:

using System;
using
System.Web;
using
System.Web.Services;
using
System.Web.Services.Protocols;

[WebService(Namespace = "http://webservices/")]
[WebServiceBinding(ConformsTo
= WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
   
public Service () {

       
//Uncomment the following line if using designed components 
        //InitializeComponent(); 
   
}

    [WebMethod]
   
public string GetListOfCountries()
    {
     
// it might be a good idea to get the values out of a database or from Microsoft CRM
       
string[] arrayCountries = new string[] { "Afghanistan","Albania","Algeria","..."};
        return string
.Join(",,", arrayCountries);
   
}
}

Last step, we will call the web service and init our suggestion text box. Add the following code to your onload event handler:

var countries = new Array();
var
obj;

var
f = function GetListOfCountries()
{
   
return countries;
}

function CallWebService()
{

   
var objHttp;

   
// create an XmlHttp instance
   
objHttp = new ActiveXObject("Microsoft.XMLHTTP");

   
// Create the SOAP Envelope
   
strEnvelope = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
           
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
           
" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
           
"  <soap:Body>" +
           
"    <" + "GetListOfCountries" + " xmlns=\"http://webservices/\">" +
           
"    </" + "GetListOfCountries" + ">" +
           
"  </soap:Body>" +
           
"</soap:Envelope>";

   
//<?xml version="1.0" encoding="utf-8"?>
    //<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    //  <soap:Body>
    //      <GetListOfCities xmlns="http://webservices/" />
    //  </soap:Body>
    //</soap:Envelope>

    // Set up the post
   
objHttp.onreadystatechange = function()
    {
       
// a readyState of 4 means we're ready to use the data returned by XMLHTTP
       
if (objHttp.readyState == 4)
        {
           
// get the return envelope
           
var szResponse = objHttp.responseText;
                        
            var
startTag = "<string xmlns=\"http://webservices/\">";
            var
endTag = "</string>";
            var
cities;

            var
valueStart = 0;
            var
valueEnd = 0;

           
//Parsing the returned XML
           
valueStart = objHttp.responseXML.xml.indexOf(startTag, valueEnd) + startTag.length;
           
valueEnd = objHttp.responseXml.xml.indexOf(endTag, valueEnd+1);

            var
tmpCountries = objHttp.responseXML.xml.substring(valueStart, valueEnd);

           
countries = tmpCountries.split(',,');


           
obj = SuggestionTextBox(document.getElementById('address1_country'), f, true);

       
}
    }

   
var szUrl;
   
szUrl = "http://website/WebServices/Service.asmx/GetListOfCountries";

   
// send the POST to the Web service
   
objHttp.open("POST", szUrl, true);
   
objHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   
objHttp.send(strEnvelope);
   
}

CallWebService()
;

Thats it. Do you like it? Please let me know if that works fine for you or if you made any improvements. I'd love to hear from you!

Other interesting blogs regarding this topic:

Accessing Web Services From CRM Forms
http://blogs.msdn.com/arash/archive/2006/02/01/521565.aspx

Address Validation in Three Easy Steps!
http://www.invokesystems.com/cs/blogs/mscrm/archive/2006/06/21/38.aspx

Working with CRM Form Lookup Controls Programmatically
http://blogs.msdn.com/arash/archive/2006/03/28/562846.aspx

Finally there: Show and hide fields based on the users role!
http://ronaldlemmen.blogspot.com/2006/05/finally-there-show-and-hide-fields.html

Inserting City and State Automatically based upon Zip Code
http://blogs.msdn.com/midatlanticcrm/archive/2006/06/22/Inserting_City_and_State_Automatically_based_upon_Zip_Code_Microsoft_CRM_3.aspx