Tip #173: Don’t disable quick create for standard entities

During a recent deployment, users started seeing the following error in CRM for Tablets when creating opportunities.

errortablet

The curious thing about this error was that it did not happen in any other interface, and only happened in the tablet app when creating records. Viewing existing records did not give us this error, and app traces gave no additional details.

Working with Microsoft support, it was determined that we were seeing the error because we had disabled “quick create” on the Opportunity entity.

After updating the quick create form for Opportunities to include all of our key fields and re-enabling the entity for quick create, users could once again create opportunity records from the tablet app.

Lesson learned: Don’t disable quick create on standard system entities if those entities are used via the tablet app. it expects quick create to be there.

Tip #172: Easy forecasting with Dynamics CRM

Dynamics CRM deployment can amass vast quantities of data, both relevant and irrelevant. If this information is not used, it’s a burden on your infrastructure (on premises) or your wallet (online), and a dead weight for your business. It’s important to know or, at very least, have appreciation of forecasting techniques, for example, as demonstrated by our resident tipster .

Sometimes the job can be accomplished more effectively with the use of lesser known and documented Dynamics CRM features. Recently I uncovered one of these hidden gems. Want to know what is going to happen tomorrow in your business? Just use audit logs!

I can see the future!

Almost forgot. Dear lawyers, have a nice day!

CRM Tip of The Day (the “website”) takes no responsibility whatsoever for any loss or damage, cost or expense (either directly or indirectly) incurred by individuals or businesses resulting from any error, omission or misrepresentation in any information contained within this web site. Unless stated otherwise, all information on this web site is supplied without any warranty, condition or other term as to the quality of any information, product or service, or their suitability for any particular purpose. Your use of any information or materials on this website is entirely at your own risk, for which we shall not be liable. It shall be your own responsibility to ensure that any products, services or information available through this website meet your specific requirements. The website is not liable to you or anyone else for any loss of income, profit, business contracts or goodwill or any indirect or financial loss suffered whether arising in negligence or otherwise arising in connection with information provided or use of this web site. The content of the pages of the website website are for your general information and use only. It is subject to change at any time and without notice. Neither we nor any third parties provide any warranty or guarantee as to the accuracy, timeliness, performance, completeness or suitability of the information and materials found or offered on this website for any particular purpose.

Tip #171: If email router is having a slow day or how to add custom index

Sometimes things are slow. Very. Slow. So slow that your email router starts spitting dreadful messages:

#9628 – An error occurred while delivering the e-mail message with subject “None of your business” in mailbox foo@bar.baz for delivery to https://crm.bar.baz. System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault]: SQL timeout expired. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).

If you are on CRM Online, contact support, not much else you can do. On premises, however, it’s a different story. The most important bit of the message is highlighted.

tl;dr

If your email router keeps generating SQL Timeout errors, and you have a large number of email records (YMMV but think millions not thousands), then try adding the following index to EmailHashBase table:

CREATE NONCLUSTERED INDEX [indx_router] 
   ON [dbo].[EmailHashBase] 
(
	[ActivityId] ASC,
	[HashType] ASC
) ON [PRIMARY]

Longer version or how to fish

SQL timeout means we can skip CRM tracing and go straight to SQL Profiler.

  1. Start SQL Profiler, select T-SQL template. Make sure all columns are available, set database filter to your foobar_MSCRM database only to reduce noise. If possible, also filter the user by setting a condition on the account used to run email router.
  2. Ready? Start the trace, restart email router service (to force the operation without waiting for the polling interval). Keep your eye on the log, the moment you get the error message, stop SQL trace
  3. Now you have a massive trace to work with (your definition of “massive” may vary). What I usually do is go through the trace, select and copy bunches of select statements, paste into a SQL query window and run
  4. Sooner of later you’ll find a statement that just hangs. In my case it was something like
    WITH Candidates
    	 (
    		  ActivityId
    	 ) AS
    	 (SELECT  ActivityId
    	 FROM     EmailHashBase WITH (NOLOCK)
    	 WHERE    ActivityId IN
    		(SELECT  ActivityId
    		  FROM   EmailHashBase WITH (NOLOCK)
    		  WHERE    HashType = 0
    		           AND Hash IN (-101500970,-295814632)
    		  GROUP BY ActivityId
    		  HAVING   COUNT(ActivityId) >= 3
    		)
    		  AND HashType = 1
    		  AND Hash IN (-248594596,-742304120)
    	 GROUP BY ActivityId
    	 HAVING   COUNT(ActivityId) >= 2
    	 )
    SELECT   TOP 1 a.ActivityId
    FROM     ActivityPointerBase AS a WITH (NOLOCK)
    WHERE    a.ActivityId IN
    		 (
    		 SELECT ActivityId
    		 FROM    Candidates AS c
    		 WHERE(
    			(SELECT COUNT(*)
    			   FROM    EmailHashBase AS h
    			   WHERE   h.ActivityId = c.ActivityId
    			       AND h.HashType   = 0
    			) <= 3
    		    ) 
    		 )
    ORDER BY a.ModifiedOn DESC
    go
    
  5. That’s where you need to possess some SQL skills or get someone who does. Find which part is exactly slow, check the execution plan, look at where clauses and indexes, think. What was suspicious in my case is that EmailHashBase table had over 2 million records but the only helpful index was on ActivityId and HashType condition for some reason pushed SQL to an index scan.
  6. After adding a new combined index on ActivityId and HashType, the entire statement execution dropped from few minutes to under 1 second. And the router was happy again.

So here you have it. Measuring your SQL Server performance, identifying bottlenecks (specific to your schema and deployment) and tackling them by either throwing more hardware at the problem or by doing some troubleshooting, is a very important part of all on premises installations. And the best part of adding custom indexes is that it’s 100% supported.

Tip #170: There is no queue like a business queue

When user wants to add item to a queue, the default view used to perform the lookup is the “Business Queues” view.
Business Queue View
Don’t try to look it up in customizations – it’s not there and seems to be hard-coded. Not only that, it’s not documented anywhere [I could find] making it extremely difficult to understand what is it, how to deal with it and how to explain it to the end users.

Not for the first time, SQL Server Profiler and troubleshooter’s hunch to the rescue.

Business queue is a queue that is assigned as default to neither users nor teams.

Here you have it. I understand why it’s not defined as a system view – it’s one of those – impossible to define in Advanced Find. If you have a queue that does not show in Business Queues view (typically after the upgrade from 2011), just find and remove link to it from the teams or users using it as a default. In other words, find users and teams that have field Default Queue linked to the queue in question and set it to null.

Tip #169: Update related records with a workflow

Ever wish you could use a workflow to update related/child records? For example, when I update the address on an account, update the address on all of the related contacts.

You can, with the help of the very helpful CRM 2011 Distribute Workflow Activity assembly written by Alberto Gemin on Codeplex.

While this says “CRM 2011” in the name, it works fine on CRM 2013 and CRM 2013 SP1.

  1. Import the solution from Codeplex
  2. Create your child entity workflow(s). In this example, create a workflow for the contact entity, check the box to run as a child workflow, uncheck the box to run on create of a record, and add your desired step.
  3. Create the master workflow that will trigger the child workflow. In this example it would be a workflow that runs on update of the address fields.
  4. Add a step. If you have successfully deployed the solution, you should see a new step called “DWF AG Utilities:Distribute One to Many.”
  5. In the step properties you need to specify two values: the database name of the 1:N relationship and the child workflow you created in step 2.
  6. Publish the workflow.

Now, every time the master workflow is executed, it will run the child workflow on each related record. This works with both background (asynchronous) and real-time (synchronous) workflow processes.

 

Tip #168: Renumber the pipeline stage

When you use Business Process Flow, the stages are categorized using the stage category option set. The categorization allows you to have standard process stage categories across multiple processes. While your various process flows may have stages with different names, the stage category provides consistency between process flows and allows you to chart opportunities with different sales processes in the same chart.

When you change the process stage of an opportunity, the process stage category is captured in the “Pipeline Stage” field of the opportunity. This field is a text field, and the value captured is a chronological number with the name of the category of the selected process stage. Charts like the standard Sales Pipeline chart use this field, and the number helps sort the chart funnel in the correct order.

One thing users may notice when viewing the chart is that the numbers are not meaningful. They may start at any number. For example, in this chart the numbers start at 8. When you move to your production environment, they may start at number 13.

Screenshot 2014-06-28 21.00.18

Here’s how you can renumber the values in the pipeline stage field:

  1. Edit the “Stage Category” global option set
  2. Remove any options you are not using.
  3. Add an option to the option set.
  4. Publish
  5. Remove the option you added in step 3.
  6. Publish

Now when you change the opportunity process stage, the numbering should start with 1.

Note–this does not modify the existing opportunities. They still retain the former value. You will need to update these records.

  • If you have a small number of opps with mis-numbered process stages, manually open each opportunity and click “next stage” then click the back stage arrow.
  • If you have a large number of opps with mis-numbered process stages, use a workflow to update the opportunities and set the process stage to the currently selected process stage.
  • You can also use the export to Excel feature to bulk update process flow stage. Create a view that includes the process flow stage (not pipeline stage), export to Excel, checking the box to export for reimport, then import using the CRM import utility.

Once you do this, your sales pipeline chart will be numbered more logically.

Screenshot 2014-06-28 21.06.25

 

Tip #167: Where did my navigation menu go?

On one of your forms you notice that you no longer have the navigation bar/navigation menu. Typically this is the right-most drop down menu on the top of the form, but for a specific entity, you notice it is missing.

Click the “Form Properties” button and go to the “Display” tab. On this tab there is a checkbox for “show navigation items.” If this box is unchecked, the navigation menu will no longer display on the form. One of your customizers may have unchecked this box.

This is a useful feature for simple forms without many navigation item links.

properties

Tip #166: Become role customizer ninja

If you frequently modify security role and your wrist hurts because of all tiny mouse movements, there are some undocumented explicit links on the role dialog that could make your life much easier.
Role Editor

Clicking on the entity name (e.g. Account) will cycle all privileges for this entity (i.e. Create, Read, etc) through all access levels (i.e. none, user, business unit, etc).

Clicking on the privilege name (e.g. Create) will cycle this privilege through access levels for all listed entities.

Tip #165: 1:1 with security twist

Usability of 1:1 relationships stretches far beyond UI candy. They can become a very useful tool that secures parts of the same logical record. For example, financial services company might use account entity to hold information about their customers but due to Chinese walls within the company, investment manager should not be able to access tax profile of the customer while taxation specialist should not have visibility of the investment details.

Create two new entities, Tax Profile and Investment Profile, create 1:1 relationship between Account and each of these entities then configure and apply appropriate security roles that limit access to one or another profile entities for specific users. That way, investment manager will not have access to tax information (or will have read-only access only, for example) while taxation agent will see bupkis instead of Cayman Islands account details.

Tip #164: Not all roles are created equal

It’s a reasonably well-known fact that recreating roles from scratch and adding all privileges to replicate one of the system roles is not the same as copying that system role. There are some hidden privileges that are not exposed via security dialog.

This topic has been discussed and documented for CRM 4.0 and for CRM 2011.

In CRM 2013 the role dialog has been seriously cleaned up and hidden roles were no more (for example, previously missing prvCreateApplicationFile privilege is now explicitly exposed via Application File entity).

Enter SP1. If you create new role and make it radiate green by ticking all the boxes, turns out that this role will be missing some 64 privileges that are in the System administrator role (helpful script). Comes as no surprise that most of the missing privileges are related to new SP1 functionality in the area of SLAs and entitlements. Unless security dialog is completely revised, CRM functionality will always be one step ahead and the advice stands: copying system roles and creating from scratch are not the same.