Sunday, December 20, 2015

Custom Entity or Standard Entity – that is the question

Microsoft Dynamics Platform is often referred to as xRM (where “x” in xRM can represent “anything”) because it enables us as business analysts and developers to customize the standard CRM solution to build custom line of business solutions to address specific business requirements.
When building a custom solution, you often face the question: whether to use a standard entity or to create a custom entity. Making this design decision is partly art and partly science. Also, your experience (both good and bad) from the past projects plays an important role.
In this article, I will discuss a few basic guidelines that I have used. Note that the following guidelines are based on Dynamics CRM 2015.

Native features and functionality associated with the standard entity

Are there any features and functionality associated with the standard CRM entity that you would like to leverage and that cannot be replicated without significant effort and custom development? If so, it will be in your best interest to use the standard entity. It will save you much effort in terms of development and maintenance in the long run. Also, you will be able to take advantage of future feature improvements and enhancements released by Microsoft.
Example 1: Only Accounts, Contacts and Leads can be included in a marketing list. If you plan to create marketing campaigns for companies or people in your custom solution, your best bet is to use one of these entities rather than creating a custom entity.
Example 2: If you need the standard CRM functionality of qualifying a lead and automatically creating account, contact and opportunity while onboarding a job or a project, you should consider using the Lead entity. Creating a custom entity is likely to require significant custom development and future maintenance to achieve the same results.
Example 3: Opportunities and Cases have a Customer field which can store both Accounts and Contacts. If you need this capability, you should consider using these entities in your solution. Otherwise, you will need to build this feature yourself.

Security

Are there any restrictions in terms of who can view and edit the data stored in this entity? For example, if in a solution for the insurance company, only the claims department employees can view and edit the claims data, it would make sense to create a custom entity to store claims rather than repurposing a standard entity like Case (incident). If you store claims in the Case entity and decide to use CRM for managing customer service cases either now or in the future, all users who have a “Read” permission to the Case entity can view Claims as well. You may be able to use Field Level Security to restrict certain fields from non-Claims department employees. However, this is likely to require more effort in terms of configuration, maintenance and administration.
Here’s another side note specific to custom “activities”. When you create a custom Activity entity, permissions defined for standard CRM Activities (such as email and task) would apply to this custom entity as well. If you have special security requirements for this entity, you may not want to define this as “activity”. You will have to weigh the pros and cons of each approach.

Contact entity to store “People” data

Typically you would want to use the Contact entity to store “people” or “persons” data. For example, if you are creating a solution for schools, you should first consider using the Contact entity to store profiles of parents, teachers and students. You can use Relationship Type or Contact Type field to identify the person’s role and either use separate forms or separate tabs on the same form that you can show or hide depending on the Contact Type. However, if the requirements and processes related to these Contact Types are fundamentally different, it may make sense to create separate entities to store respective profiles. One advantage of using one (Contact) entity to store all “people” is that search results within the Contacts view would include everyone matching the search criteria. Alternatively, you can train your users to use the global search feature that can include multiple entities including custom entities.
Another approach is to use the Contact entity as the base entity, create custom entities for specific Contact Types and create pseudo 1:1 relationship between the Contact entity and custom entity. Dynamics CRM does not natively support 1:1 relationship. However, you can simulate this by creating 1:N and N:1 relationships between Contact and custom entity. In our example, you will use the Contact entity to store common data such as name, address, email and phone number and create custom entities for Parent, Teacher and Student to store data specific to these Contact Types with 1:N and N:1 relationships to the Contact entity. Because CRM does not natively support 1:1 relationship, it will be your responsibility as a customizer to enforce data integrity. This approach will also enable you to configure permissions specific to Contact Type. For example, Student Administration users will be able to view and edit Student data but not Teacher data. I will write in more detail about how you can implement this solution in a later post.

Account entity to store “Company” data

On the same lines, you should consider using the Account entity to store company data including customers, vendors and business partners. This also enables you to use a lot of built-in functionality as well as standard relationships including contacts, opportunities and cases without customization. However, the same principles described earlier apply when making a decision.

Email Templates

You can create entity specific Email Templates only for certain standard entities including account, contact, lead, opportunity, quote, order, invoice, case, contract and service activity. You will have to use global templates for all other entities including custom entities you create. However, you would be able to use workflows and dialogs to create/send emails that include fields from custom entities. See the following post for details: Workaround for Email Template Limitations.

Repurposing Opportunity, Quote, Order and Case entities

If you are using Dynamics CRM to build a line of business solution that is unrelated to sales or service, it may make sense to repurpose Opportunity, Quote, Order and Case entities to take advantage of some built in features that come standard with these entities. This may save you time required for customizations and custom development. For example, you may use the Order entity to track Projects if you need to add line items to track time and material (products) used for the project. CRM also calculates the total of line items automatically.

Useful Common CRM features

There are many useful common features that you may want to leverage in your xRM solution. These features are available for both standard and custom entities. Therefore, they should not have any bearing on your decision to use one or the other. These features include:
  • Business Process Flows
  • Workflows and Dialogs
  • Notes and Attachments
  • Activities
  • Connections
  • Sending Email (including Direct Mail)
  • Mail Merge
  • Document Management
  • Access Teams
  • Queues
  • Allow Quick Create
  • Duplicate Detection
  • Auditing
  • CRM for Phones
  • CRM for Tablets
  • Reading pane in Dynamics CRM for Outlook
  • Offline capability for Dynamics CRM for Outlook
  • Timer control on entity form
I welcome your ideas and lessons you have learned from your experience on this topic from your projects.

Friday, November 27, 2015

Reporting on Custom Contact Fields in MDM using Power BI

Microsoft offers Microsoft Dynamics Marketing (MDM) Content Pack for Power BI. It allows you to easily access and analyze your data from Dynamics Marketing. The content pack uses a descriptive model on top of the OData feed, with all the entities and measures needed such as Programs, Campaigns, Marketing Contacts and Companies, Leads, Lead Interactions and Lead Scoring, Email Marketing Messages and Web Sites, behavioral observations, budgets, financial transactions, performance KPIs, and many more.
However, if you have created custom Contact fields in MDM, they are not included in the dataset. In this article, I will walk you through the steps to create a simple report that includes custom Contact fields in MDM.
For the purpose of this article, I created the following custom Contact fields in MDM. These fields will be initially populated in Dynamics CRM and synchronized to MDM via standard integration. Once populated, Marketing department can insert these fields in the email messages and templates. They can also use these fields to create marketing lists in MDM.
Name
Title
Data Type
MembershipNumber
Membership Number
Text
EnrollmentDate
Enrollment Date
Date/Time
LastTransactionDate
Last Transaction Date
Date/Time
ContactType
Contact Type
Category
Values: Member, Marketing Contact
MembershipLevel
Membership Level
Category
Values: Platinum, Gold, Silver
PointsBalance
Points Balance
Integer


In order to create a Power BI report that includes the above fields, you will need to use Power BI Desktop which is available as a free download.
Once you have connected to the OData feed from MDM, you will be asked to select entities (tables) you want to include in a query as shown in the following screenshot. Note: The steps for connecting to OData feed are the same as for connecting to Content Pack (see the link above).
Select the following 5 tables.
Contacts
ContactCustomFieldsText
ContactCustomFieldsInteger
ContactCustomFieldsCategory
ContactCutomFieldsDateTime
Then click “Edit” button.


MDM stores custom field values for each contact in a separate table for each data type as name/value pair. It stores each value in a separate record. For example, if the Contact has Contact Type of Member and Membership Level of Platinum, these values are stored in two separate records as illustrated in the following screenshot. One record has ContactId, Name as "ContactType" and Value as "Member". Another record has the same ContactId, Name as "MembershipLevel" and Value as "Platinum". Our goal is to retrieve these values, create separate columns (instead of rows) for each field and merge them with the Contact query.

Next, remove the ID column (first column above which is simply a unique identifier for the each row in the table) so that we can pivot the records on the Name column (see next step). We are then left with ContactId, Name and Value columns.

After removing the ID column, select the Name column (by clicking on the heading).
Click Transform > Pivot Column.
Select “Value” for Values column.
Expand Advanced Options and select “Don’t Aggregate”.
Click OK.


You should now see two columns created for each Contact for each of the Category fields as shown in the following screenshot.

Next, we will merge the above query with Contacts query.
Select Contacts query in the left hand navigation.
Click Home tab and Merge Queries in the Combine group.


Select the Id column for Contacts by clicking the heading.
Select ContactCustomFieldsCategory query from the dropdown.
Select ContactId column for the second query by clicking on the heading.
Join Kind defaults to “Outer Join” which is what we want because not all Contacts may have the matching records in the second table.

Click OK.
This adds the “NewColumn” to the Contacts table as shown below.

Next, expand the column by clicking on the button with two arrows. Select the fields you want to include and click OK.

Next, rename the columns by eliminating the default prefix.

As you can see, Power BI Query Editor records the steps you performed in the “Applied Steps”. You can delete the steps to revert to the previous state if necessary (for example, if you make a mistake).
You can use the same steps to merge the other fields (text, integer, date/time) into Contacts query.
Once you are satisfied with the query, click “Close & Apply” to apply the steps and close Query Editor.


This will take you to the Report canvas. As you can see in the following screenshot, custom fields are now available for reporting.

I also created two new columns to display date fields in m/d/yyyy format using the following DAX formula.

The following screenshot shows the report that includes some of the custom fields for each Contact. Of course, you can create charts and more complex reports including DAX calculations based on your custom data. For example, you may want to create a bar chart showing email message clicks by membership level.


Once the report has been created, you can publish it to Power BI (website) by clicking on the “Publish” button and following the prompts. The following screenshot shows the report in Power BI.

In this article, we saw how to create a Power BI report to include custom Contact fields created in MDM.



Wednesday, October 14, 2015

Measuring Customer Loyalty using Dynamics CRM

I recently received an invitation from my mobile phone company to participate in a survey by responding to five simple questions by text message.

The first question:
How likely are you to recommend Company X to your friends and colleagues? Reply with a number between 1 and 10 where 10 is ‘Extremely Likely’
This question is used as part of the tool called Net Promoter Score which is a customer loyalty metric developed by Bain Company consultant Fred Reichheld. Customers who choose a score of 9 or 10 are labeled promoters. Those who choose a score of 1 to 6 are categorized detractors, while those who select 7 or 8 are deemed passively satisfied. The net promoter score (NPS) measures the difference between the percentages of customers who are promoters and detractors. For example, if 60% of your customers are promoters and 20% are detractors, your net promoter score is 40. An NPS that is positive (i.e., higher than zero) is considered to be good, and an NPS of +50 is considered excellent. Reichheld’s research suggests that changes in a company’s net promoter score correlate with changes in its revenues i.e. increasing NPS is a leading indicator of positive revenue growth. In other words, it can be used to predict positive revenue growth.
There are several survey tools that work with Dynamics CRM including Mojo Surveys and ClickDimensions. Once you have your survey responses collected, you can present this information in a graphical format for easy access by your sales, marketing and service teams.
I used the following steps to accomplish this.
  1. Create two custom entities
    1. Customer Loyalty Survey: This entity contains the following fields.
      1. Name
      2. Survey Date
      3. Total Responses (integer)
      4. Total Promoters (integer)
      5. Total Detractors (integer)
      6. Net Promoter Score (decimal, may be positive or negative, between -100 and 100)
    2. Customer Loyalty Survey Response: This entity contains the following fields.
      1. Name
      2. Customer Loyalty Survey (lookup to the above entity)
      3. Response (integer between 1 and 10)
      4. Comments (if any)


  1. Create a Workflow to summarize survey results
    1. Trigger: When Customer Loyalty Survey Response is created
    2. Step: Calculate and update Total Responses, Total Promoters, Total Detractors and Net Promoter Score
      Note: Net Promoter Score = (Total Promoters – Total Detractors) / Total Responses


  1. Create a chart to display Net Promoter Score by Survey
After you import survey responses into Customer Loyalty Survey Response entity, the results including NPS are automatically calculated by the workflow created above. The results are then available for viewing as view and chart similar to a screenshot below.


NPS can be incorporated as a Key Performance Indicator (KPI) in a dashboard or a balanced scorecard for your sales, marketing and service teams.