How to change the DashboardSettings of maximum controls limit in Dynamics CRM2011/2013

The maximum number of controls allowed on CRM2011 or CRM 2013 dashboards is 6. You cannot put the more than 6 graphs/charts/iframes/web resources etc. on the dashboard.

We can extend the number of controls as per the user needs. This setting is applied to the server not a organization setting. So you cannot change this setting for CRM Online but you can change this for an on-premise installation.

Option 1: Using Window Power Shell we can achieve it.

  1. Open the Windows Power Shell command window
  2. Add the Microsoft Dynamics CRM PowerShell snap-in using

Add-PSSnapin Microsoft.Crm.PowerShell
Sometimes You may get the message saying something like “Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.Crm.PowerShell because it is already added.” It is fine no problem.

3.  Run the following 3 commands

$setting = Get-CrmSetting -SettingType DashboardSettings

$setting.MaximumControlsLimit = 10

Set-CrmSetting -Setting $setting

After that open CRM, still you will be see only 6 components on the dashboard design, however you can add extra components based on how much you have set the limit.

Once you crossed the limit you will get following error message.

DashboardSettings

Option 2: If Powershell does not work, use following C# code to do the same

  public static void UpdateDashboardSettings()
        {
            //Create Instance of Deployment Service
            DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(new Uri("http://CRMServer/Organization/XRMDeployment/2011/Deployment.svc"));
            //Use Default network Credentials(User should de Deployment Admin in Deployment Manager and System Admin in CRM)
            service.ClientCredentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;

            //Retrieve Current Dashboard Settings MaximumControlsLimit
            Microsoft.Xrm.Sdk.Deployment.RetrieveRequest retrieveReq = new Microsoft.Xrm.Sdk.Deployment.RetrieveRequest();
            retrieveReq.EntityType = DeploymentEntityType.DashboardSettings;

            Microsoft.Xrm.Sdk.Deployment.RetrieveResponse retrieveRes = (Microsoft.Xrm.Sdk.Deployment.RetrieveResponse)service.Execute(retrieveReq);
            if (retrieveRes != null && retrieveRes.Entity != null)
            {
                DashboardSettings dsCurrentResult = (DashboardSettings)retrieveRes.Entity;
                if (dsCurrentResult != null)
                    Console.WriteLine("Current DashboardSettings MaximumControlsLimit is " + dsCurrentResult.MaximumControlsLimit);
            }
            //Update Current Dashboard Settings MaximumControlsLimit = 10
            Microsoft.Xrm.Sdk.Deployment.UpdateRequest updateReq = new Microsoft.Xrm.Sdk.Deployment.UpdateRequest();
            DashboardSettings ds = new DashboardSettings();
            ds.MaximumControlsLimit = 10;
            updateReq.Entity = ds;
            Microsoft.Xrm.Sdk.Deployment.UpdateResponse updateRes = (Microsoft.Xrm.Sdk.Deployment.UpdateResponse)service.Execute(updateReq);

            //Retrieve again after updating Current Dashboard Settings MaximumControlsLimit
            Microsoft.Xrm.Sdk.Deployment.RetrieveRequest retrieveReq1 = new Microsoft.Xrm.Sdk.Deployment.RetrieveRequest();
            retrieveReq1.EntityType = DeploymentEntityType.DashboardSettings;
            Microsoft.Xrm.Sdk.Deployment.RetrieveResponse retrieveRes1 = (Microsoft.Xrm.Sdk.Deployment.RetrieveResponse)service.Execute(retrieveReq1);

            if (retrieveRes1 != null && retrieveRes1.Entity != null)
            {
                DashboardSettings dsUpdatedResult = (DashboardSettings)retrieveRes1.Entity;
                if (dsUpdatedResult != null)
                    Console.WriteLine("After Updating DashboardSettings MaximumControlsLimit is " + dsUpdatedResult.MaximumControlsLimit);

            }
        }

NOTE: You need add microsoft.xrm.sdk.deployment DLL from SDK to access those Deployment classes and methods. User who is running this should be Deployment Admin in Deployment Manager and Sys Admin in CRM

Incase if you are getting 404 error while accessing Deployment service, you need to check your CRM web server IIS settings and make sure XRMDeployment is not configured in Hidden Segments in IIS, Follow below steps to remove/add XRMDeployment setting in IIS

  1. Open Internet Information Services(IIS) Manager
  2. Expand Server on left navigation
  3. Expand Sites on the Left Navigation
  4. Click on Microsoft Dynamics CRM
  5. Click on “Request Filtering” icon in IIS on right side window
  6. Click on “Hidden Segments” tab on Request Filtering window on right side
  7. If “XRMDeployment” exists then select “XRMDeployment” and right click on “Remove” and say “Yes” to remove “XRMDeployment” from Hidden Segments
  8. Once you are done executing PowerShell, SDK Code you can add using “Add Hidden Segment” option, enter “XRMDeployment” in Hidden Segment window and click on “OK” to close the window.

Build dynamic HTML table and display on entity form using JavaScript and HTML web resource in Dynamics CRM 2011

I have a requirement to build dynamic HTML table and display on Account form using HTML web resource and JavaScript.

Here is my scenario; I have two entities; Account and AccountService. There is 1:N relationship between Account and AccountService. AccountService entity has name and account fields. Requirement is to get account services from AccountService entity based on account guid and display on Account form.

I have created new HTML web resource for displaying account services and added on Account form.

Here is HTML web resource code, I am using oDATA and JavaScript in HTML web resource.

 

<html>
<head>
    <title>Account Services</title>
    <script src="ls_Script_JQuery_1.7.1.min"></script>
    <script src="ClientGlobalContext.js.aspx"></script>
    <script language="javascript" type="text/javascript">
        function loadAccountServices() {
            //Get Account Guid
            var accountId = window.parent.Xrm.Page.data.entity.getId();
            //Get Account Services
            var accountServices = getAccountServices(accountId);
            if (accountServices != null && accountServices.length > 0) {
                var tableData = "";
                for (var i = 0; i < accountServices.length; i++) {
                    var service = accountServices[i].ls_name;
                    if (service != null) {
                        //dynamically add table data with Service Names
                        tableData = tableData + "<tr><td>" + service + "</td></tr>";
                    }
                }
                //Create HTML table
                var table = "<table style='font-family:Segoe UI;font-weight:normal;font-size:13px;'><tr style='height:20px'><td style='text-decoration:underline;'>Account Services</td></tr>" + tableData + "</table>";
                //show table data on the Account form
                window.document.writeln(table);
            }
        }
        //get Account Services
        function getAccountServices(accountId) {
            var serverUrl = location.protocol + "//" + location.host + "/" + Xrm.Page.context.getOrgUniqueName();
            var oDataUri = serverUrl + "/xrmservices/2011/OrganizationData.svc/ls_accountserviceSet?$select=ls_name&$filter=ls_Account/Id eq guid'" + accountId + "'";
            var accountServices = null;
            $.ajax({
                type: "GET",
                contentType: "application/json; charset=utf-8",
                datatype: "json",
                url: oDataUri,
                async: false,
                beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("Accept", "application/json");
                },
                success: function (data, textStatus, XmlHttpRequest) {
                    if (data != null && data.d.results.length > 0) {
                        accountServices = data.d.results;
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }
            });
            return accountServices;
        }
    </script>
</head>
<body onload="loadAccountServices();">
</body>
</html>


How it looks on Account Form:

Account Services

Microsoft Dynamics CRM 2011 Update Rollup 16 is available

Update Rollup 16 for Microsoft Dynamics CRM 2011 is available. This article describes the hotfixes and updates that are included in this update rollup.

Check out here for complete details: Rollup 16 for Microsoft Dynamics CRM 2011 KB Article

Lot of issues resolved in Update Rollup 16, check out following issues:

  1. Emails generated by RightFax software are not tracked by CRM when using Exchange 2010.
  2. UnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #3244E1C6 when deleting a solution.
  3. Email attachments are not being deleted from the dbo.Attachment table when their parent record is deleted.
  4. SSL Offloading does not work when CRM is not using Claims/IFD authentication.
  5. OverriddenCreatedOn* attribute is missing from V3 Custom Entities.
  6. Clicking on report preview throws error on an Updated Organization from Update Rollup 6, “HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #3423D182”.
  7. When you click to create a folder for a record in CRM 2011 the SharePoint page is shown instead of the list part grid page. This causes confusion with customers.
  8. Conditional formatting breaks page navigation in view within CRM for Outlook client.
  9. When you select an email that is tracked in CRM, and you have the reading pane viewable for emails, Outlook may hang or become unresponsive. Once Outlook returns controls and becomes responsive you notice that the Track in CRM form region for the tracked in CRM email contains a large number of parties on the TO, CC, or BCC.
  10. Retry logic causes unexpected results on some OrganizationServiceProxy methods.
  11. Appointment created and deleted from the web will only be deleted from the organizers Outlook calendar. Occurs when the meeting organizer sends Outlook invitations.
  12. When you attempt to configure the outlook client for an organization and the organization friendly name matches an organization that you already have configured, you will be prompted that an organization with that display name already exists. If you then correct the display name and proceed with the configuration, configuration will succeed. However the next time that you launch the configuration wizard the wizard will fail to launch. “There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator.”
  13. When you have more subjects in the subject tree than can be viewed without a scrollbar, the scrollbar is not shown in IE or FireFox.The scrollbar is shown correctly in chrome.
  14. When you attempt to view html web resources in the CRM web or outlook client application by opening them from the ribbon, the web resources that are shown are old versions. This occurs even after you have published changes to the web resources. If you clear temporary internet files the web resources are shown correctly.
  15. When you create a process step using create, update, or send email step and you put in the body of the email more than 65K characters and then publish and execute the process the step will fail.
  16. Outlook Appointment Form is not saving fields updated by Silverlight / JavaScript.
  17. A 404 error is seen when accessing organization. Prior to getting 404 you deleted thousands of managed optionset values through the SDK or UI without replacing those deleted optionset values with new values. Then you published customizations.
  18. Deployment Manager and Plugin Registration performance is slow due to DC communication.
  19. Appointments and Service appointments are automatically shared with the user that shared the record.
  20. Organizations that upgraded from Microsoft Dynamics CRM 4.0 and have existing ISV.config customizations in place may encounter situations when the import of managed solutions fails to update or overwrite components in the ribbon that were created as part of the Microsoft Dynamics CRM 2011 upgrade.
  21. Searching for a contact in address book fails raising this error:”The Contacts folder associated with this address list could not be opened; it may have been moved or deleted, or you do not have permissions. For information on how to remove this folder from the Outlook Address Book, see Microsoft Outlook Help” or the data in the columns is not correct.
  22. Outlook pops up error if clicking CRM folders before the loading of CRM toolbar: “Microsoft CRM has encountered a problem and needs to close. We are sorry for the inconvenience.”
  23. Can’t renew\copy a Contract when Contract Line items dates are greater than the Contract.
  24. Custom Plugins registered against the RetrieveMultiple message and specifying “none” as the Primary Entity will fail with a SerializationException starting with the December 2012 Service Update due to an unknown Type originating from the plugins that are part of the ActivityFeeds solution.
  25. Some fields lose data on save and synchronization when focus is not moved from the field when using the CRM Outlook client.
  26. Reports do not render correctly after applying CRM 2011 Update Rollup 12.
  27. “SQL Server error” on Campaign Activity quick find search if including “channeltypecode”.
  28. Sporadically, e-mail sent from Outlook router are sent with winmail.dat attachment.
  29. Re-tracking contacts in child contact folders result in duplicate contacts after synchronization.
  30. When a form that contains a Silverlight Web Resource in Microsoft Dynamics CRM 2011, the Silverlight control fails to be resized when the user resizes the form making it difficult to access some portions of the Silverlight resource.
  31. You can access System Settings no matter the security role assigned.
  32. Users are unable to view audit history is the records they own are part of another record that they do not have sufficient privileges to access.  If they only happens for one record, users are unable to see the remaining audit details they do have access to.
  33. Summery Filter is not shown when using N:N relationship criteria.
  34. Export to Excel in Outlook fails with long relationship/entity/field names.
  35. Unable to navigate to next page records through the CRM form window using the short cut (Up/Down Arrows) in the top right corner of form.
  36. When using Process Driven forms in Microsoft Dynamics CRM 2011, users with restricted privileges may encounter “Error on Page” messages or “Error:  Unable to get property ‘trigger’ of undefined or null reference” error dialogs.
  37. Memory growth is experienced in the Microsoft Dynamics CRM Client for Outlook when the Activity Feeds Solution is present in the Microsoft Dynamics CRM Online organization.
  38. Mail Merge fails for Office 2013 Outlook clients when using Cached Mode.
  39. Currency symbol keeps as the base currency symbol in activity created by Dialog.
  40. User from 1 business unit are able to see records of other business unit when entity records between business units are merged and the records are owned by the default teams for the associated business units.
  41. If the chart pane is enabled on any view for an entity in the Outlook client, and if the user utilizes the “Email a Link” feature and selects the current view, the URL that is generated and then copied to a blank e-mail will contain invalid parameters. Clicking on this link then generates a CRM platform error, which indicates that invalid parameters were passed to the request.
  42. Offline script generated Orders change Order ID’s upon offline/online Sync.
  43. When you attempt to use a service account to impersonate users in Exchange to poll for email to be delivered into CRM using the email router, and that service account does not have a mailbox the CRM email router will not be able to proceed either with check access or during normal execution.
  44. Controls on the new driven forms introduced in the Microsoft Dynamics CRM 2011 December 2013 Service Update are not being updated with data that was modified as part of Microsoft Dynamics CRM 2011 plugin.
  45. Outlook saved views are not sorted alphabetically like in the web client.
  46. When JavaScript references a lookup via the Microsoft Dynamics CRM 2011 SDK and tries to access the EntityType property to see the record type, users with the Read Only license access will receive Undefined, instead of the proper entity name.
  47. Cannot delete managed solution because of IsMapiPrivate and LeftVoiceMail fields.
  48. Workflow failed with “The deserializer has no knowledge of any type that maps to this name”
  49. With a Decimal Number field with Precision parameter > 6,  a number beginning with 0.000000 errors on Orders. “Error. An error has occurred”.
  50. There is an error in XML document (1, 1181). when validating MAPI properties through EWS.
  51. When you use the CRM web client or CRM client for Outlook you notice memory increasing when you use the SharePoint List Web Part for CRM.
  52. Deployments with large datasets in Microsoft Dynamics CRM 2011 may suffer performance bottlenecks on default views, lookups, and queries if the EnableRetrieveMultipleOptimization registry setting is set to zero.
  53. Notes in the Outlook preview section are sorted by modified date instead of created date.
  54. In Update Rollup 13 users cannot print the whole grid page with Internet Explorer 10.
  55. When users change the field ‘Start Time’ (or any other date field) to third Sunday of October, for any year, in the Brasilia time zone.  the field is changed to 1/1/1970.
  56. Users receive “not read” receipts if <DeleteEmails> is true in the EmailAgent.xml for the Email Router.
  57. Post Polaris: the Timeout option in wait condition of workflow disappears on Edit.
  58. JavaScript errors are shown when using the CRM Web Client with DOM Local Storage disabled in IE.
  59. After applying Update Rollup 12 on the Microsoft Dynamics CRM 2011 Server, users of the offline edition of the Microsoft Dynamics CRM 2011 Client for Outlook are unable to configure their Offline Scheduled Sync settings under Personal Settings.
  60. When running an SSRS report and using certain specific locales in personal options in CRM, the report does not contain the correct format as the correct language is not selected based upon the current users locale. In this specific example end user has selected English (India) locale of 16393.
  61. When you use IE 10 and you attempt to view an email activity using the CRM email activity form, the body of the email is not fully shown. This occurs when the email that was viewed was promoted into CRM either by the Outlook client or Email router and the email body was well formed HTML.
  62. When synchronizing service appointments in Microsoft Dynamics CRM 2011 from Outlook To CRM, the activity parties on the appointments are being rescheduled even though they may not have changed.  This can potentially cause workflows or plugins to be invoked unnecessarily on the server producing inconsistent results.
  63. Multi-threaded SDK app crash with System.InvalidOperationException.
  64. Unable to view Personal E-mail Templates with EnableRetrieveMultipleOptimization is set to 2.
  65. When you attempt to choose a value from a multi parameter drop down in a SSRS report from within CRM web or Outlook client you receive a script error. “Error: No such interface supported”.
  66. You cannot import a solution which contains an out of the box chart where that out of the box chart has been deleted in the destination system.
  67. After Update Rollup 12, datetime picklist does not show the selected value when opened.
  68. After Update Rollup 12, rows of Audit History view are not aligned.
  69. Importing an updated solution version fails to import with UR12+
  70. Changing the resource on a service activity creates temporary duplicates.
  71. Service activity tooltip/color not updated for change in status reason.
  72. Deployment Manager not opening after making the failover to the mirror SQL.
  73. Cannot use print preview for draft replied emails with images after Update Rollup 12 & 13.
  74. Outlook offline reports not showing parameter pane.
  75. Unable to configure CRM outlook client when TurnOffFetchThrottling is enabled.
  76. When an error is raised when submitting the merge dialog form, and upon a second attempt to merge the data you change the selection of fields on the dialog, those changes are not submitted to the platform. The initial set of fields are used instead of updated.
  77. UI rendering issue with dynamic position option set for web hosted applications.
  78. Multi-text content is not printed correctly.
  79. When the Deployment Profile is set to Local System after Update Rollup 12 for the Email Router is applied, when you restart the service, the router hangs and will not send messages. When you enable verbose logging, you see that it does not continue checking settings. Also, the Email Router Configuration Wizard window either hangs or takes a really long time to open.
  80. Jscript error when opening field editor for Yomi field.
  81. Subgrid does not display correctly when using Internet Explorer 8.
  82. Post Update Rollup 12: prvWriteSdkMessageProcessingStep privilege required to enable some workflows.
  83. LeftVoiceMail field is missing on some custom activities post Update Rollup 12.
  84. Tracked Email Not Promoted if Opened in Inspector View from Sent Items.
  85. Voice mail messages are being rejected by the email router with the error below. These emails were tracked fine when the mailboxes were on Exchange 2007. However the issue started occurring post migrating the mailboxes to Exchange 2013. Issue is only with the emails that come as part of voice mail messages, rest of the emails are getting tracked fine.
    Instance validation error: ‘OneOff’ is not a valid value for MailboxTypeType
  86. Recurring Appointment “Data Propagation” does not list Custom attribute.
  87. Most recently viewed data disappears periodically after you have used to open more than 40 records.
  88. SQL Deadlocks when calling Associate request adding users to teams.
  89. Add activity button gets enabled for closed case even though it should be grayed out.
  90. The first tab on the form becomes visible unexpectedly overriding customizations.
  91. Filter in view does not work when for Option Set containing entries with ‘&’ character.
  92. Invalid XML when creating a campaign with special characters in view criteria.
  93. Data from related entities missing when exporting to Excel from the CRM for Outlook Client.
  94. Consider the scenario where you are creating an e-mail template. During the process copy part of a rich text or HTML formatted document and paste it into the subject line. The template creation appears to have a normal subject however the resulting e-mails from the template contain style tags.
  95. Any modification to Duplicate Detection Email Template corrupts it.
  96. When you attempt to use a view that has a condition for Owner Equals Current User’s Teams and the user does not belong to any team with a security role you receive an error: Invalid Argument.
  97. Outlook Filter settings not taken into consideration when performing a quick search.
  98. IME Settings for “Multiple lines of text” fields are not respected.
  99. Custom entity grid icon is not visible in Outlook.
  100. You receive error messages when accessing CRM fields in the CRM for Outlook client. “An error has occurred”.
  101. Set Regarding does not work on a CRM 4.0 Client connecting to a CRM 2011 Server.
  102. Save & New when editing existing Connection does not populate Connected From.
  103. When you copy and paste a tracked recurring appointment in the CRM client for Outlook, the copied recurring appointment will become untracked in CRM, however a duplicate will be synchronized to Outlook upon each manual or background synchronization.
    This occurs when the source recurring appointment contains an instance of the recurrence which has been modified or deleted and it is outside of the current effective range. For example an instance of the recurring appointment was canceled many months ago.
  104. UR12+ Spacing between dynamic fields in Processes is not maintained correctly.
  105. InvalidOperationException Errors Occur After Installing Microsoft Dynamics CRM Client For Outlook Update Rollup 11 Critical Update.
  106. SharePoint documents are stored to the root folder, not under accounts/contacts.
  107. When you create an new record and as part of the process of creating the new record you add notes to the record before performing the initial save some notes may not be created. This occurs if you click Save, Save & Close, or Save & New on the Ribbon with focus still in the body of the note that is being entered.
  108. Retry logic causes unexpected results on some OrganizationServiceProxy methods.
  109. Outlook Client quick find search box suggests search will be on current view.
  110. When opening and closing forms in Microsoft Dynamics CRM Client For Outlook, users may notice the memory of the WebFormsHost processes climb over time until the application reports it is low on memory.
  111. When installing the slipstreamed UR6 version of the CRM client for Outlook and the “Give me updates for Microsoft products and check for new optional Microsoft software when I update Windows” option is checked in Control Panel -> Windows Update -> Change Settings, Windows Update will automatically install the Critical Update (build 2903) patch during installation.  However, the Microsoft.Crm.Outlook.Diagnostics.exe executable (and potentially other files) that it installs are build 3557 instead of 2903, causing Diagnostics to crash and problems when uninstalling.
  112. Customer is using Outlook 2007 with the option ‘Send immediately when connected’ unchecked. So, when he composes a new mail, it first goes to the Outbox and when we click on Send/Receive, it goes out.
    When the CRM add-in is enabled and if we open the e-mail when it is in Outbox just to edit something, or simply to see the content and when we click on Send/Receive after that, the mail does not go out.
  113. After Update Rollup 14, the Print Preview on records does not display correctly. The footer overlaps the last tab with content.
  114. Outlook crashes when you have ShortTel Communicator and CRM client for Outlook installed.
  115. Mail merge fields not appear in word, template field definition not applied after template selection.
  116. Unable to configure CRM outlook client when TurnOffFetchThrottling is enabled.
  117. Cannot update StateCode and StatusCode of Phone Call entity via plugin code.
  118. When you type text and separate each value you want to resolve by a semi colon in a partylist field, only the first entry you types will persist after the auto resolve completes if each entry would resolve to more than 1 value.
  119. After CRM 2011 Update Rollup Up 12 lengthy form names in the Form selector are getting mixed with record data. When viewing an entity form with a display name that exceed the width of the left navigation it overflows onto the form. Before UR12 form names were simply truncated and “…” was appended. Post UR12 the form display name overflows onto the body and can over run the data. See screenshots for examples. In testing this issues is present in all IE versions, Chrome and Firefox.
  120. Clients having the Update Rollup 11 Critical Update are unable to configure if the server has attributes with a DisplayMask of ValidForAdvancedFind set to be non-searchable.
  121. Error importing org from CRM 2011 UR14 – System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name ‘LeftVoiceMail’ in table ‘ActivityPointerBase’ is specified more than once.
  122. Outlook client unresponsive during startup.
  123. Copying and pasting multiple lines of text from a Word document to the body of a CRM E-mail activity record causes additional line breaks to be inserted in between each line. This issue did not occur prior to Update Rollup 12.
  124. Exporting solution does not contain relationship information if changed.
  125. Quick find within a Custom dashboard for Articles does not render any results.
  126. When you run Contact Duplicate Detection rule Full Name does not appear in the list.
  127. When the MAPI store for the Microsoft Dynamics CRM 2011 Client for Outlook is empty, updates to the cache may cause Outlook to terminate unexpectedly.
  128. When replying to e-mail activity records in the application, if a user presses the enter key in the body, followed by the delete key, a line break is inserted into the body of the form.
  129. Shared activities do not show in outlook offline mode.
  130. CRM Outlook Client Attempts To Handle Tracked Items In Shared Calendar.
  131. When you open an entity form and you attempt to navigate to a side navigation item, for example Activities or Closed Activities, the navigation may be interrupted. You may instead find that your form focus is now the first selectable field on the main section of the entity form. For example on the Account entity form, Name field is selected.
  132. Entity records containing textarea attributes such as Notes on the Reading Pane in the Microsoft Dynamics CRM 2011 Client for Outlook may cause the client to become unresponsive.
  133. Developer experience for script debugging is broken.
  134. Same Ribbon Display Rule in multiple solutions cause extremely slow form load.
  135. Script Error clicking links on side navigation before form fully loads.
  136. Wait Until condition are not being triggered if watched attribute contains NULL value.
  137. Outlook crashes when using CRM client for Outlook UR15 or UR11 CU.
  138. When you attempt to choose a value from a multi parameter drop down in a SSRS report from within CRM web or Outlook client you receive a script error.
    Error: No such interface supported
  139. Outlook client fails to load or crashes when client OrgDBOrgSettings are set.
  140. Changes made to the personal view query is not updating in Outlook client since Update Rollup 12.
  141. After installing Update Rollup 15 for CRM 2011 the Mail Merge button on the entity record Add tab does not seem to do anything when clicked.
  142. In some environments, conditions may exist when the registry keys of the Microsoft Dynamics CRM for Outlook Client are being duplicated when being read causing an exception to occur that terminates the Outlook process.
  143. This functionality changed UR12+. The custom activity form is not automatically closing when clicking on Mark Complete. The ribbon buttons are disabled and only option is to close with the X. Pre UR12 the form closed when clicking “mark as complete”
  144. Users of the Microsoft Dynamics CRM 2011 Client for Outlook may be unable to configure the client if they are utilizing a proxy PAC file.  The configuration wizard will terminate with a “Object reference not set to an instance of an object” error.
  145. Creation and deletion of business units cannot be done in a timely manner.
  146. When you are using the CRM 4 client for Outlook while connected to a CRM 2011 organization using IFD authentication you are not able to access the Organization (SOAP) endpoint or the ODATA (REST) endpoint.
    This works if you are using the CRM 2011 client for Outlook or the CRM web client.
  147. The process of assigning records from one user to another user and changing business units via the SetBusinessSystemUserRequest takes a long time to execute if the original owner owns a large number of records, for example 50K contacts. This process can also cause the tempdb log to increase in size and cause problems if you run out of disk space for tempdb.
  148. Dashboard Tab Ordering is incorrect.
  149. The owner of the child record in a merge inherits invisible rights to the master record.

Dynamics CRM 2011 JavaScript debugging in Internet Explorer 11

Microsoft rebuilt the F12 tools from the ground up in Internet Explorer11. They have a brand new UI and new functionality to make your developing and debugging faster and easier.

You can access them from within a browser window by hitting F12. If your keyboard doesn’t have function keys, you can select ‘F12 developer tools’ from the ‘Tools’ menu.

You can use the Debugger tool to examine what your code is doing, when it’s doing it, and how it’s doing it. Pause code in mid-execution, step through it line-by-line, and watch the state of variables and objects at each step. New features in the Debugger tool include:

  • No-refresh debugging. Set your breakpoints  and go without reloading and losing state.
  • Tabbed document interface for easier management of multiple scripts.
  • Scrollbar that highlights breakpoints and search matches.

Development and debugging tasks it makes easier:

  • Seeing what led to a function call using the Callstack.
  • Making compressed or minified code more readable.
  • Monitoring web worker creation and  execution.

There are eight distinct tools, each with their own tab in the F12 tools interface. Here you’ll find an image of each tool, a quick summary of what it does and what’s new, and a couple of typical development or debugging tasks the tool makes easier. Check the link ‘Using the F12 developer tools in Internet Explorer 11’ http://msdn.microsoft.com/en-us/library/ie/bg182326(v=vs.85).aspx

Here are the steps how to debug Dynamics CRM JavaScript code in Internet Explorer11.

Step1:  Before you try to debug JavaScript code make sure ‘Disable script debugging (Internet Explorer)’ and ‘Disable script debugging (Other)’ options are un-checked in ‘Advanced’ tab of Internet Explorer options, these options are checked by default.

JSDebugging1

Step2:  Press the F12 key on your keyboard to open the tools or select ‘F12 developer tools’ from the ‘Tools’ menu.  You will see ‘DOM Explorer tool (CTRL + 1)’ left side, click on ‘Debugger (CTRL+3)’

JSDebugging2

Step3:  Click on ‘Open Document (CTRL+O)’ and check CRM page.

JSDebugging3

Step4:  Expand CRM page in ‘Open Document (CTRL+O)’ and check your JavaScript file is loaded and click on your JavaScript file and set the debugger wherever you want

JSDebugging4

JSDebugging5

SQL Generic error in Accounts Merge and Contacts Merge in Dynamics CRM 2011

Exception Message: SQL Generic error

Route Cause: Sometimes we used to get ‘SQL Generic error’ exceptions during Accounts merge or Contacts merge.  We enabled SQL Server Profiler and tried again merging for some of the failed merge accounts and contacts, traced what exception is, it is (Violation of UNIQUE KEY constraint ‘UQ_PrincipalObjectAccess’. Cannot insert duplicate key in object ‘dbo.PrincipalObjectAccess’)

For Accounts Merge: When any of Subordinate account contacts/sub accounts are shared with Master account owner, it creates a record in PrincipalObjectAccess table. When merging accounts, it is again trying to create the same record in PrincipalObjectAccess table,  since this record already exists in PrincipalObjectAccess table which causes Generic SQL error.

For Contacts Merge: It is same for contacts merge too, when Subordinate contact is already shared with Master contact owner, it creates a record in PrincipalObjectAccess table when merging contacts, it is again trying to create the same record in POA table, since this record already exists in PrincipalObjectAccess table which causes Generic SQL Error.

Solution 1: I tried to revoke those privilege records from PrincipalObjectAccess table using RevokeAccessRequest class in SDK, for some reason it is not deleting those records. It just sets AccessRightsMask and InheritedAccessRightsMark values to 0.  I guess this is what RevokeAccessRequest does, it just zero’s out the permissions shared rather than deleting the record.
Tried again merging accounts and contacts after revoking privilege records from PrincipalObjectAccess, for some reason it did not work.

Solution 2: Following solution worked for me, you can use following code do the same.

  1. Try changing the master account owner to CRM Admin user
  2. Merge the accounts/contacts
  3. Change owner back to original owner who owns before Merge.
    private void MergeFailedAccounts(CRM.SDK.Account subOrdinateAccount, CRM.SDK.Account masterAccount, CRM.SDK.Account updateContent)
        {
            IOrganizationService service = CRMHelper.GetCRMConnection();

            OrgServiceWrapper orgServiceWrapper = (OrgServiceWrapper)service;
            //Get Organization Service Context User Credentials
            string strUserDomainName = orgServiceWrapper.ClientCredentials.Windows.ClientCredential.Domain + "\\" + orgServiceWrapper.ClientCredentials.Windows.ClientCredential.UserName;
            string userFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true'>
                                                    <entity name='systemuser'>
                                                        <attribute name='systemuserid'/>
                                                        <filter type='and'><condition attribute='domainname' operator='eq' value='{0}' /></filter>
                                                    </entity>
                                                </fetch>", strUserDomainName);    
            //------------------
            //1-Get CRMS Service(Admin User) UserId for changing account owner
            //------------------
            var userFetchExp = new FetchExpression(userFetchXML);
            EntityCollection userEntityCollection = service.RetrieveMultiple(userFetchExp);
            if (userEntityCollection.Entities.Count > 0)
            {
                //------------------
                //2- Change Master Account owner to CRMS Service(Admin User)
                //------------------
                AssignRequest cRMSServiceUserAssignReq = new AssignRequest
                {
                    Assignee = new EntityReference("systemuser", userEntityCollection.Entities[0].Id),
                    Target = new EntityReference("account", masterAccount.Id)
                };
                // Execute the AssignRequest
                service.Execute(cRMSServiceUserAssignReq);

                //------------------
                //3-Merge Accounts
                //------------------
                MergeRequest request = new MergeRequest
                {
                    Target = new EntityReference("account", masterAccount.Id),
                    SubordinateId = subOrdinateAccount.Id,
                    UpdateContent = updateContent,
                };

                MergeResponse response = (MergeResponse)service.Execute(request);

                //------------------
                //4- Change Master Account Owner back to orginal owner who was before Merge
                //------------------
                AssignRequest accountOwnerAssignReq = new AssignRequest
                {
                    Assignee = masterAccount.OwnerId,
                    Target = new EntityReference("account", masterAccount.Id)
                };
                // Execute the AssignRequest
                service.Execute(accountOwnerAssignReq);
            }
        }

 private void MergeFailedContacts(SDK.Contact subOrdinateContact, SDK.Contact masterContact, SDK.Contact updateContent)
        {
            IOrganizationService service = CRMHelper.GetCRMConnection();

            OrgServiceWrapper orgServiceWrapper = (OrgServiceWrapper)service;
            //Get Organization Service Context User Credentials
            string strUserDomainName = orgServiceWrapper.ClientCredentials.Windows.ClientCredential.Domain + "\\" + orgServiceWrapper.ClientCredentials.Windows.ClientCredential.UserName;

            string userFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true'>
                                                    <entity name='systemuser'>
                                                        <attribute name='systemuserid'/>
                                                        <filter type='and'><condition attribute='domainname' operator='eq' value='{0}' /></filter>
                                                    </entity>
                                                </fetch>", strUserDomainName);            
            //------------------
            //1-Get CRMS Service(Admin User) UserId for changing account owner
            //------------------
            var userFetchExp = new FetchExpression(userFetchXML);
            EntityCollection userEntityCollection = service.RetrieveMultiple(userFetchExp);
            if (userEntityCollection.Entities.Count > 0)
            {
                //------------------
                //2- Change Master Contact owner to CRMS Service(Admin User)
                //------------------
                AssignRequest cRMSServiceUserAssignReq = new AssignRequest
                {
                    Assignee = new EntityReference("systemuser", userEntityCollection.Entities[0].Id),
                    Target = new EntityReference("contact", masterContact.Id)
                };
                // Execute the AssignRequest
                service.Execute(cRMSServiceUserAssignReq);

                //------------------
                //3-Merge Contacts
                //------------------
                MergeRequest request = new MergeRequest();

                request.Target = new EntityReference("contact", masterContact.Id);
                request.SubordinateId = subOrdinateContact.ContactId.Value;
                request.UpdateContent = updateContent;

                MergeResponse response = (MergeResponse)service.Execute(request);

                //------------------
                //4- Change Master Contact Owner back to orginal owner who was before Merge
                //------------------
                AssignRequest contactOwnerAssignReq = new AssignRequest
                {
                    Assignee = masterContact.OwnerId,
                    Target = new EntityReference("contact", masterContact.Id)
                };
                // Execute the AssignRequest
                service.Execute(contactOwnerAssignReq);
            }
        }

Microsoft Dynamics CRM 2011 Update Rollup 15 is available

Update Rollup 15 for Microsoft Dynamics CRM 2011 is now available. This update only contains bug fixes and no new functionality.

Check out here for complete details: Rollup 15 for Microsoft Dynamics CRM 2011 KB Article

Update Rollup 15 for Dynamics CRM 2011 provides the following improvements:

  • It includes a new feature that is scheduled to be delivered with Microsoft Dynamics CRM 2013. This feature moves the CRM client-specific workload into its own process so that it no longer shares memory with the Microsoft Office Outlook process. This feature is also known as Process Isolation.
  • It includes an upgrade to Microsoft SQL Server for Windows CE 4.0 for better memory management, better caching, and connection enhancements.
  • It updates the CRM for Outlook configuration files to make the CRM for Outlook SDF files compatible with SQL Server for Windows CE 4.0.
  • It materializes the Address Book Provider to reduce performance issues that  are caused by large address books.
  • It limits the amount of active open forms.
  • It provides a MAPI Lock time-out.
  • It hard codes a previous registry setting that prevented pinned views from pulling down information to local SQL CE cache. This new DisableMapiCaching  setting defaults to a value of 1. For more information about the behavior of this setting, see Slow Performance When Pinning Views in Microsoft Dynamics CRM
    Note: This value can be overridden by modifying the DisableMapiCaching  setting in the OrgDbOrgSettings tool if the critical update has been applied to the Dynamics CRM server. For more information, see OrgDBOrgSettings Tool for Microsoft Dynamics CRM 2011.

Update Rollup 15 resolves the following issues:

  • New organization setting to disable presence for Contacts.
  • Report Editor User Interface edit buttons for Categories, Related Record Types and Display have button displaying  “…” intended for editing the field options.
  • After the General and Administration tabs user focus moves to the address bar before returning to the form.
  • When a view list is opened, focus is not placed on the options and you cannot tab or use the arrow keys.
  • Dashboard Tab Ordering is incorrect.
  • Custom Entities are not available for Appointment lookup fields.
  • Menu not navigable with the keyboard when using screen reader.
  • Dynamics CRM 2011 SharePoint 2010 List Web Part Ignored When Using Metadata Managed Columns.
  • There are two tabs which are untitled frames on the new dashboard editing page when tabbing off the Name field.
  • Slow performance logging into the CRM for Outlook client when the organization has a large amount of teams. I.E. 5000 teams.
  • When qualifying a Lead using the Sales Refresh forms in Microsoft Dynamics CRM 2011, the contact information is missing from the newly created Opportunity form.
  • Performance issues when adding or removing a team  member due to the p_SystemUserBuEntityMapReinit stored procedure.
  • A blank page appears with an “Error on page” message in the Internet Explorer window when running a custom report on a custom  view.
  • Lookup view of the Site entity is not sorted correctly.
  • The CRM for Outlook client intermittently removes the due date from appointments.
  • Amounts of Opportunity Products are not calculated if  Opportunity Revenue is “User Provided”.
  • After upgrade to Update Rollup 12 you receive an error when trying to modify a workflow by deleting a condition from a Check Condition or Wait step. This error occurs if the Check Condition or Wait Condition contains a condition for a lookup field that was previously existing in the step. The error is as follows:This process cannot be created, updated or activated because it was created outside the Microsoft Dynamics CRM Web application. Your organization does not allow this type of workflow.
  • Users can select inactive queues under My Work | Queues when they should not appear here.
  • When you leverage retrieve multiple optimizations in  CRM 2011 and you request data from CRM using the 2007 endpoint those requests may result in errors if deletion state code attributes are  automatically included in the list of columns to be retrieved. These deletion state code attributes are added automatically for backward  compatibility to CRM 2007 endpoint requests.
  • Business required Currency field shows original value on mobile express when saving as blank.
  • SDK- FetchXmlToQueryExpressionRequest does not work after Update Rollup 11.
  • When creating a many-to-many relationship using both sides of the relationship as the same entity, the fields can be dragged and dropped to certain places on the navigation menu; however, they will continue to appear at the bottom.
  • After installing Update Rollup 12 there is an error using User Saved Views in Service Calendar. “Record is unavailable
    The requested record was not found or you do not have sufficient permissions to view it.”
  • The Service Activity page becomes very slow when using Internet Explorer 8 after Update Rollup 12.
  • When you run a report against all records on all pages for an entity shown in a sub area on an entity form, the report will not execute.
  • Goal entity’s Actual and In-Progress Associated Views  are incorrect.
  • Unable to create copies of emails in Microsoft Dynamics CRM when prompted: “This e-mail is already being tracked in Microsoft Dynamics CRM. Do you want to create a copy of this item in Microsoft Dynamics CRM?”
  • Loading order of web resource script files is not respected after Update Rollup 12.
  • Reports started rendering with incorrect results after COD applied for running reports on a view with a related entity.
  • Unable to select, copy, and paste lookup text after Update Rollup 12.
  • DOM elements are being leaked in FilterPopup base class.
  • DOMElement _elmNavigationInstructions in Ribbon causing memory leak.
  • _elmLarge DOM Element in Ribbon Toggle Button Control  not disposed causing memory leak.
  • Service Calendar not refreshing.
  • Records with a custom N:1 relationship to connections fail to merge.
  • Records with a custom N:1 relationship to connections fail to merge. Updates made in connection record will not be cascaded to reciprocal connection record.
  • DOMElement _elmScrollCurtain and _elmStoredFocus in Ribbon causing memory leak.
  • Recurring Meetings Start Time change synchronization issue from Outlook to CRM.
  • Many unnecessary spaces in the email body of Email Activities.
  • Notification is incorrectly shown for child dialogs.
  • Tasks do not appear in Activities view if User is  assigned to team in Child BU.
  • CRM Mobile Express saving numeric/currency values with incorrect CrmCultureInfo.
  • POA table not cleaned up after deleting related Activity types.
  • Jscript logic issue on Phone Call Activity.
  • CRM 2011 UR11 Critical Update Causes Dashboard Views Not to Refresh.
  • Error on Dynamic export when Advanced Find linked entity filtered on Date field.
  • Getting error “Table alias ‘alias name’ is not  unique” when opening certain views.
  • Unable to save a check condition or wait condition step  if lookup condition exists on step.
  • Custom duration fields are defaulted to 1 minute after Update Rollup 12.
  • “Contains” and “Does Not Contain”  workflow data filters are not available post Update Rollup 12.
  • Post Update Rollup 12, the SetFocus called after form  is enabled for user interaction cancels navigation.
  • Set regarding broken when using CRM 4.0 client with CRM  2011 Update Rollup 12 server.
  • Grid View Selector DOM Elements are being leaked.
  • CRM 2011 Outlook Client goes to “Online”  state automatically when in offline mode.
  • Post Update Rollup 12 Offline Synchronization Filters  resets the Outlook Synchronization Filters unexpectedly.
  • Records with a custom N:1 relationship to connections  fail to merge.
  • Updates made in connection record will not be cascaded  to reciprocal connection record.
  • Link-entity filter criteria not shown in UI when a link-entity column is added first.
  • When you use the CRM client for Outlook 32-bit, you may notice high memory usage and once memory increases to much Outlook may exit unexpectedly.
  • CRM client for Outlook exits unexpectedly after navigating to CRM folders and opening CRM records. (form Isolation)
  • Scheduling Alert warning missing post Update Rollup 12.
  • DOM element event handlers are not being removed in all places causing memory leaks.
  • Lync presence icon absent in Grid View/Form controls.
  • Appointment owner changes to an attendee that synchronizes the appointment first.
  • Group Policy causing white screen for lookup in Outlook Client.
  • Sending Mail Merge To More Than 3000 Recipients Causes Errors. “An error has occurred in Microsoft Dynamics CRM Mail Merge.”
  • Server is queried for Duplicate detection settings on every record when Outlook goes Online.
  • KBs word wrap getting ignored when a / is at end of line.
  • If field is used twice on a form, merge fails if field is null in the child.
  • QualifyMember message not available in the plugin registration.
  • DOMElements being leaked out of Ribbon Group.
  • Ribbon Tooltips Are Leaking DOM Elements.
  • Email Router: Attachment file name of incoming emails is coming with GUID appended in it.
  • Import managed solution fails when contains custom activity attribute changes.
  • Duplicate detection return no records when tracking contact from Outlook.
  • IE10: Notification cannot display while first click “Export” button on “Export Data to Excel” wizard in Outlook client.
  • Deleting pinned views can corrupt TabOrderXml causing rending issues in Outlook.
  • Exporting Application ribbon contains duplicate value in XML.
  • Exporting Reports Opens Window Outside of CRM client for Outlook.
  • Report page cannot work when the report is created with existing file on outlook client.
  • UR14 Outlook Client fails to synchronize contacts after reconfigure.
  • Outlook task removes due date intermittently.
  • After upgrade to UR12 you receive an error when trying to modify a workflow by deleting a condition from a Check Condition or  Wait step.
  • Applying Update Rollup 14 for Microsoft Dynamics CRM      2011 causes several database updates to not be applied if the system had  Update Rollup 13 applied previously.
  • After installing the Update Rollup 11 Critical Update for the Microsoft Dynamics CRM 2011 Client For Outlook, grids are no longer being refreshed.
  • SetStateRequest for KB Article should need prvWriteArticle privilege.
  • Outlook crashes in this scenario: Install UR6 -> Patch to UR11 -> Patch to UR11 + -> Uninstall Patch UR11+
  • Outlook Client failing to install patch when machine name/ domain are longer than 125 characters with Error code:1638
  • Report page does not work when the report is created with existing file on outlook client.
  • Set Regarding not returning record after applying  Update Rollup 11 Critical Update.
  • WebFormsHost process does not allow to open forms once recycling of processes is complete in Terminal Service scenario.
  • Publishing CRM report failed as parent report already links to another report with same name.

Dynamics CRM 2011 SDK version 5.0.17 available

Check out new Dynamics CRM 2011 SDK version 5.0.17 available in MSDN web site.

http://msdn.microsoft.com/en-us/library/dn457782.aspx

Check out What’s changing in the Next Major Release?

http://msdn.microsoft.com/en-us/library/dn281891.aspx

Download Microsoft Dynamics CRM 2011 SDK 5.0.17 from following MSDN page.

http://www.microsoft.com/en-us/download/details.aspx?id=40321

Set tracing/logging in Dynamics CRM 2011 E-mail Router

Turn on tracing: Follow below steps to enable E-mail router logging,

  1. Login to CRM E-mail Router server
  2. In Windows Explorer, locate the Microsoft.Crm.Tools.EmailAgent.xml file. By default, this file is located in the following folder: SystemDrive:\Program Files\Microsoft CRM Email\Service
  3. This is the configuration file for the Email router , Open the file by using Notepad or another text-editing program.
  4. In the file, examine the <SystemConfiguration> node, and then scroll down the text toward the end of the file to find the following statement: <LogLevel>1</LogLevel>By default, this value is set to 1. Modify this statement so that it reads as follows: <LogLevel>3</LogLevel>, If you want to save logs into text file, you can specify the log file location as <LogFile> c:\emailrouterlog.txt </LogFile>  where you want it to put the log file. If you don’t mention log file location, all logs will be saved into windows event logs under MSCRMEmailLog. It is in this Event Viewer log view that the events appear.
  5. Save the file.
  6. Restart the E-mail Router Service.

When the LogLevel is set to 3 and a logfile location is specified, all router actions will be written to a log file in the specified location. If we don’t specify the log file location, all router actions will be logged in windows event logs. You will find a new Event Viewer log view that is named MSCRMEmailLog.

The router log will give you a lot of details, including granular detail on each incoming and outgoing email that it processes. Open the log file from the location specified,  or open the windows event logs and review the captured error messages. You can find the problem with a specific email by searching the log file for the subject of the email.

Here is the sample Microsoft.Crm.Tools.EmailAgent.xml with logging options.

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <SystemConfiguration>
    <MaxThreads>50</MaxThreads>
    <MaxThreadExecution>600000</MaxThreadExecution>
    <SchedulingPeriod>1000</SchedulingPeriod>
    <ConfigRefreshPeriod>5000</ConfigRefreshPeriod>
    <ConfigUpdatePeriod>3600000</ConfigUpdatePeriod>
    <LogLevel>3</LogLevel>
   <LogFile> c:\emailrouterlog.txt </LogFile>
    <ProviderOverrides>
      <CacheCapacity>1024</CacheCapacity>
      <PendingStatusDelay>300000</PendingStatusDelay>
      <SendingStatusDelay>1800000</SendingStatusDelay>
      <MaximumDeliveryAttempts>10</MaximumDeliveryAttempts>
      <EWSRetrieveMessageCount>10</EWSRetrieveMessageCount>
      <BatchSize>5</BatchSize>
      <RequestBatchSize>5</RequestBatchSize>
    </ProviderOverrides>
  </SystemConfiguration>
</Configuration>

Turn off tracing: While email router logs are helpful while troubleshooting an error with the router, they capture large volumes of detail while enabled, so I would suggest they should be turned off when you are done otherwise it causes disk space issues in the server if it is enabled for long time, seriously it caused us in QA when we forgot to turn off in QA.

Improve AsyncoperationBase table performance in Dynamics CRM 2011

For every async operation happens in Dynamics CRM 2011, a record gets saved in Asyncoperationbase table. So there is a possibility to grow this table very fast. To control growing this table size and save disk space, need to make sure following settings are done in Workflows and Plugins.

Workflows: If you open your workflow definition and go to the Administration tab, you will find the “Workflow Job Retention” option, under this you will see option to check “Automatically delete completed workflow jobs (to save disk space)”, If you click on the checkbox, it means that every time this workflow job is executed AND if it succeeds, the system job will be deleted. Selecting that option is perfect for processes that you don’t need to audit and you just need the logic to execute. However, if you need to keep a history of which workflows have executed on which records you should not select this option to delete the workflow job on completion (Note that this option is disabled by default).

AsyncOperationBase1

Plugins:  The similar option is also available for asynchronous plugin steps as well. When any asynchronous operation completes, a System Job entity is created to record the completion status. You can view these system jobs in the Web application by selecting Settings, and then click System Job. Check this option if you want plug-in related system jobs automatically deleted when the status is successful. (Note that this option is disabled by default for all asynchronous plugin steps).

AsyncOperationBase2

In case If your AsyncOperationBase table becomes too large in Microsoft Dynamics CRM, you can follow Microsoft KB article to reduce the size.

http://support.microsoft.com/kb/968520/en-us

Re-assign Account/User territory in Dynamics CRM 2011

Unfortunately Dynamics CRM 2011 does not support deactivating Territory, If you get a situation where you want to delete the existing territory, you need to first check if it is associated to any accounts or users, if the territory has salespeople(users) or accounts associated with it, the deletion will not succeed, Territory entity have 1:N relationships with “Referential, Restrict Delete” behavior on Account and User, Users cannot directly delete a territory, If the Territory has Users or Accounts associated with it, In order to delete the Territory, need to reassign associated Users and Accounts to different Territory.

Following code helps to re-assign accounts and users territory from one territory to another one.

 private void ReAssignAccountTerritories(IOrganizationService service, string oldTerritoryName, string newTerritoryName)
        {
            try
            {
                string accountsFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true' distinct='false'>
                                                            <entity name='account'>
                                                                <attribute name='accountid' />
                                                                <attribute name='name' />
                                                                <link-entity name='territory' from='territoryid' to='territoryid' alias='aa'>
                                                                    <filter type='and'>
                                                                        <condition attribute='name' operator='eq' value='{0}' />
                                                                    </filter>
                                                                </link-entity>
                                                            </entity>
                                                        </fetch>", oldTerritoryName);

                var accountsFetchExp = new FetchExpression(accountsFetchXML);

                //Get Accounts with Old Territory
                EntityCollection accountsResults = service.RetrieveMultiple(accountsFetchExp);

                string territoryFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true' distinct='false'>
                                                            <entity name='territory'>
                                                                <attribute name='territoryid' />
                                                                <filter type='and'>
                                                                    <condition attribute='name' operator='eq' value='{0}' />
                                                                </filter>
                                                            </entity>
                                                        </fetch>", newTerritoryName);

                var territoryFetchExp = new FetchExpression(territoryFetchXML);
                //Get TerritoryId based on TerritoryName
                EntityCollection territoryResults = service.RetrieveMultiple(territoryFetchExp);

                EntityReference territoryReference = null;

                if (territoryResults.Entities != null && territoryResults.Entities.Count > 0)
                    territoryReference = new EntityReference("territory", territoryResults.Entities[0].Id);

                foreach (Entity account in accountsResults.Entities)
                {
                    if (territoryReference != null)
                    {
                        //Update Account Territory with new Territory
                        account.Attributes.Add("territoryid", territoryReference);
                        service.Update(account);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private void ReAssignUserTerritories(IOrganizationService service, string oldTerritoryName, string newTerritoryName)
        {
            try
            {
                string usersFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true' distinct='false'>
                                                        <entity name='systemuser'>
                                                            <attribute name='systemuserid' />
                                                            <attribute name='fullname' />
                                                            <link-entity name='territory' from='territoryid' to='territoryid' alias='aa'>
                                                                <filter type='and'>
                                                                    <condition attribute='name' operator='eq' value='{0}' />
                                                                </filter>
                                                            </link-entity>
                                                        </entity>
                                                    </fetch>", oldTerritoryName);

                var usersFetchExp = new FetchExpression(usersFetchXML);

                EntityCollection usersResults;

                //Get Users with Old Territory
                usersResults = service.RetrieveMultiple(usersFetchExp);

                string territoryFetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' no-lock='true' distinct='false'>
                                                            <entity name='territory'>
                                                                <attribute name='territoryid' />
                                                                <filter type='and'>
                                                                    <condition attribute='name' operator='eq' value='{0}' />
                                                                </filter>
                                                            </entity>
                                                        </fetch>", newTerritoryName);

                var territoryFetchExp = new FetchExpression(territoryFetchXML);
                //Get TerritoryId based on TerritoryName
                EntityCollection territoryResults = service.RetrieveMultiple(territoryFetchExp);

                EntityReference territoryReference = null;

                if (territoryResults.Entities != null && territoryResults.Entities.Count > 0)
                    territoryReference = new EntityReference("territory", territoryResults.Entities[0].Id);

                foreach (Entity user in usersResults.Entities)
                {
                    if (territoryReference != null)
                    {
                        //Update User Territory with new Territory
                        user.Attributes.Add("territoryid", territoryReference);
                        service.Update(user);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }