CRM Indexing Management & Rebuild Index Scheduled Jobs

Reviewing index fragmentation on the CRM database is an important aspect for monitoring the CRM organizations as high levels of fragmentation will badly impact the performance, the fragmented indexes can be sorted out by reorganizing or rebuilding.

CRM provides 2 scheduled jobs for Indexes management:

  1. Indexing Management: responsible for creating indexes for any quick find columns
  2. Rebuild Index: responsible for maintaining the indexes fragmentation by doing index rebuild

Although it is supported by Microsoft to manually create or rebuild indexes but it is a best practice to let the scheduled jobs mentioned above do these 2 functions, if you needed to create a new index for a searchable column just add it to the quick find view and the next time the index management job runs it will automatically create the index for you.

Limitations to using Business Rules – CRM 2015

Here are the main limitations to using business rules from Microsoft official materials:

  • Business rules run only when the form loads and when field values change. They do not run when a record is saved, unless the scope for the rule is set at an entity level.
  • Business rules work only with fields. If you need to interact with other visible elements, such as tabs and sections, within the form you need use form scripts.
  • When you set a field value by using a business rule, any OnChange event handlers for that field will not run. This is to reduce the potential for a circular reference, which could lead to an infinite loop.
  • If a business rule references a field that is not present on a form, the rule will simply not run. There will be no error message.
  • Whole Number fields that use the formats for TimeZone, Duration, or Language will not appear in the rule editor for the conditions or actions, so they cannot be used with business rules.
  • For Microsoft Dynamics CRM for tablets, the definition of the business rules are downloaded and cached when CRM for tablets opens. Changes made to business rules are not applied until CRM for tablets is closed and re-opened.
  • When you set the value of a lookup field, the text of the primary field value that is set in the form will always match the text that is visible in the rule definition. If the text representing the primary field value of the record you are setting in the lookup changes, the value set by your rule will continue to use the text portion of the primary field value defined by the rule. To fix this, update the rule definition to use the current primary name field value.

I want to add that you can’t debug business rules as you can do when witting JavaScript code.

Moving Site Collection to Different Web Application – SharePoint

We created a site collection for saving CRM documents on Intranet web application, we wanted to move that site collection to a new web application to avoid having a single point of failure for the 2 site collections and also allow the CRM administrators to control the maximum attachment size for files stored on SharePoint.

We achieved this by running the below 2 PowerShell cmdlets:

Backup-SPSite -Identity “http://intranet.domain.com/sites/CRMDocs” -Path “C:\CRMDocumentsSiteCollection.bak”

Restore-SPSite -Identity “http://intranet.domain.com:8888/sites/CRMDocs” -Path “C:\CRMDocumentsSiteCollection.bak”

The site collection will be created if not already existing, and if we want to override an already existing site collection on the specified URL then we will need to add the -force parameter.

Then we re-configured the documents management settings in CRM to point to the new site collection URL, the good thing about CRM is that it saves the document locations relatively, so such a change in the base URL only requires updating the SharePoint site URL and everything works fine.

Please note that in case you faced a SQL timeout while re-configuring the document management settings in CRM due to having large number of documents then you will need to increase the CRM SQL timeouts on the front end servers.

CRM 2015 SLA New Features – Differences

CRM 2015 SLA is now having 2 main types:

  • Standard SLA
  • Enahanced SLA

Below is a comparison between the 2 types:

Standard SLA Enhanced SLA
Populates First Response by and/or Resolve by values in the case entity. Uses a new entity (SLA KPI Instance) to store this data.
Failure time stamped on case entity attributes. Failure/Warning times stamped on related SLA KPI Instance record displayed via a sub grid in the case form
Timer control based on case entity fields; can be directly added to case form. Timer control based on related SLA KPI Instance fields; can be added using Quick From
SLA Pause/Resume is not available SLA Pause/Resume while SLA Time calculation is automatically paused when a case is put on Hold, also the amount of time on hold is also tracked.

There is system setting that allows pausing cases SLA automatically for certain case status reasons.

The ability to pause can be disabled/enabled for each SLA.

Success actions are not available. Trigger actions when an SLA is successful

Important Considerations:

  • Cannot change SLA type once created.
  • Case SLA cannot be sorted by Enhanced SLA fields as they are now on another entity.
  • Queue Item views cannot display Enhanced SLA fields.

CRM & SQL Server BizTalk Integration

We had a project in which there was a requirement for an integration between Microsoft SQL server and Microsoft Dynamics CRM 2011 using BizTalk 2013 R2, the solution in brief was Listening on SQL server using the WCF-Custom Adapter then using the orchestration to do data mapping then send the new transformed message to a custom WCF service that handles inserting the message as a new case in CRM, below are the hard learned lessons for such integration:

  • When receiving message from SQL server with a specific schema, make sure the SQL statement is returning xml results matching the same schema defined in the orchestration or the mapping process will not be able of transforming the message to the target schema.
  • When constructing a message using message assignment in an orchestration, check the message in the constructed messages property in the construct shape to resolve the build time error in case trying to assign value to a message not constructed from a receive shape.
  • When configuring the WCF-Custom SQL binding connection, if there is only one default instance on the SQL server then you need to use the below format with double slash between the server name and the database name for the URI connection string: mssql://ServerName//DatabaseName
  • When using the WCf-Custom adapter, there is an important property named UseAmbientTransaction which is defaulted to true, this property specifies whether the adapter will use DTC transactions in the communication with SQL server or use normal queries that doesn’t require DTC, you need to make sure that DTC is enabled on SQL server and is working properly by using a tool named DTCPing, sometimes the adapter will not work properly while not throwing any errors on the BizTalk server due to DTC issues like DNS name resolution that is blocking the transaction only on the SQL server side.

The experience with this integration was fruitful, interesting, and leveraged how BizTalk can be used to build robust and powerful integration solutions.