Sunday, April 10, 2016

Build Custom Search using Dynamics CRM System Views

Dynamics CRM users have many options to search CRM data. They include Quick Find, Global (multi-entity) search and (my favorite) Advanced Find.
Advanced Find provides CRM users with a powerful tool to search for information they are looking for using flexible ways to filter, view and sort data. They can also search data across multiple entities such as account and opportunity in the same search.
However, from my experience, some CRM users find Advanced Find confusing and difficult to use especially when they have to search across entities because it requires some knowledge of entity relationships.
System Admins and Customizers can solve this problem by creating System Views with filters using placeholders. CRM users can use these views as a starting point, fill in some or all of the placeholders with known values to find what they are looking for.
Consider the following scenario. Inside Sales department users often need to find a prospect with opportunity that was created recently. However, they may or may not remember the exact name of the account, the exact date when the opportunity was created and the exact estimated revenue. However, they typically know the approximate timeframe when the opportunity was created and the approximate amount of the opportunity. They usually remember the State/Province where the customer is located.
We created the System View with the following filter criteria for the users.


Note the placeholders for Account Name, State/Province, Opportunity Created On and Est. Revenue. Inside Sales users can use this view as a starting point, fill in the values they know or remember and find the Account they are looking for.
They will use the following steps to perform the search.
  1. Navigate to Account entity
  2. Click on Advanced Find button on the top ribbon

  3. Select the appropriate system view created for searching

  4. Fill in the values they know or remember and click Results. Note that they do not need to fill in all the fields but only the ones they know or remember.
  5. CRM returns the following result based on filter criteria.


Depending on the search requirements of the users, you may have to create multiple system views for the same entity and name them appropriately so that users can select the correct view for searching. For example, some users may also need an ability to search for the customer based on a Quote created recently.

This approach makes searching easier and consistent for end users and eliminates the need for in-depth knowledge of Advanced Find and understanding of entity relationships.

Saturday, January 30, 2016

Workaround for Email Template Limitations

In Dynamics CRM, you can create entity specific email templates only for the following entities: Account, Contact, Lead, Opportunity, Case, Order, Quote, Invoice, Contract and Service Activity. You can also create a generic global email template.


However, there are many use cases where users need an ability to create and use email templates for other standard entities such as Appointment as well as for custom entities.

Standard email templates also have other limitations. For example, when you are creating an email template for the Opportunity entity, you can only insert fields from the related Contact or Account. There are situations where you may want to pull information from other related entities including custom entities into an email template.
You can take advantage of standard CRM dialog as a workaround for these limitations. This solution essentially offers the same capabilities as standard email templates for any standard CRM entity as well as custom entities.
In this example, user wants to send an email to a customer for an existing Appointment. However, user wants to be able to edit the content of the email before sending it. Because you cannot create an email template for the Appointment entity, we will use the following solution which provides the same capability as the email template.

We will create a Dialog for the Appointment entity with the following steps.
  1. Create an email.
  2. Change the status of the email to “Draft”.
  3. Display a hyperlink to the draft email as the last step. User can click on the link to open the draft email, edit it and then send it to the customer.

Here’s the screenshot of the sample dialog.



When a user runs this dialog on an existing Appointment record, the dialog creates a draft email and displays the link as follows:

A user can click on the link to open the draft email, edit it and click send.

You can use this technique for other standard CRM entities as well as custom entities in your solution.

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.