Chapter 5. Working with CRM SDK

In this chapter we are going to learn about using CRM extendibility architecture and its main components. We will discuss the CRM 2015 software development kit (SDK) and its resources. This chapter will help us to learn about CRM APIs and Web resources. We will be discussing different CRM Web services and their methods with examples. We will also write a console application using the CRM client API. We will also be discussing new enhancements for developers in CRM 2015. We will cover:

  • Understanding CRM extendibility architecture
  • Introduction to Microsoft Dynamics CRM SDK
  • Knowing about CRM assemblies
  • Understanding CRM web services
  • Using client API for CRM connection
  • Working with organization web service
  • Working with discovery web service
  • Fetching data from CRM database
  • Top five new features in 2015 update 1 for developers
  • Integrating CRM with other system

Understanding CRM extendibility architecture

Microsoft Dynamics CRM is a highly extendable business application, which means that we can always extend CRM using its APIs. It provides different component, that can be greatly extended to map with our custom business requirements. Although CRM provides a rich set of features that help us to execute different business operations without any modification, we still can extend its behavior and capabilities with supported customizations.

The following is the extendibility architecture of CRM 2015, where we can see how different components interact with each other and which components can be extended with the help of CRM APIs.

Understanding CRM extendibility architecture

Extendibility architecture

Let's discuss these components one by one and possible extendibility options for them.

CRM databases

During installation of CRM, two databases (the organization and configuration databases) are created. The organization database is named organization_MSCRM and the configuration database is called MSCRM_CONFIG. The organization database contains the complete organization-related data stored on different entities. For every entity in CRM there is a corresponding table with the name of Entityname+"Base". Although technically it is possible, direct data modification in these tables is not supported. Any changes to CRM data should be done by using CRM APIs only.

Note

Adding indexes to CRM databases is supported; you can refer to https://msdn.microsoft.com/en-us/library/gg328350.aspx for more details on supported customizations.

Apart from tables, CRM also creates special views for every entity called Filtered+Entityname. These views provide data based on the user security role so, for example, if you are a sales person you will only get data while querying the filtered view based on the sales person role. We use filtered views for writing custom reports for CRM. You can find more details on filtered views from https://technet.microsoft.com/en-us/library/dn531182.aspx.

Note

An entity relationship diagram for CRM 2015 can be downloaded from https://msdn.microsoft.com/en-us/library/jj602918.aspx.

Platform layers

Platform layers work as middleware between the CRM UI and database; it is responsible for executing inbuilt and custom business logic and moving data back and forth. When we browse CRM applications, the platform layer presents data that is available based on the current user security roles. We develop and deploy custom components on top of the platform layer.

Processes

We discussed the different process categories in an earlier chapter. A process is a way to implement automation in CRM. We can set up processes using the process designer and also develop custom assemblies to enhance the capability for the workflow designer and include custom steps.

CRM Web services

CRM provides the Windows Communication Foundation (WCF)-based Web service, which helps us to interact with organization data and metadata; thus, whenever we want to create or modify entity data or to customize CRM component metadata, we need to utilize these Web services. We can also develop custom Web services with the help of CRM Web services if required. We will be discussing CRM Web services in detail in a later topic.

Plug-ins

Plug-ins are another way to extend CRM capability. These are .NET assemblies that help us to implement our custom business logic in the CRM platform. They help us to execute our business logic before or after the main platform operation. We can also run our plug-in on transactions, similarly to SQL transactions, which means that, if any operation fails, all the changes will rollback. We can set up asynchronous and synchronous plug-ins. We will be discussing plug-in development in the next chapter.

Reporting

CRM provides rich reporting capabilities. We have many out-of-the-box reports for every module such as sales, marketing, and service. We can also create new reports and customize existing reports in Visual Studio. While working with reports we always utilize the entity-specific filtered view so that data can be exposed based on the user security role. We should never use CRM tables while writing reports. Custom reports can be developed using the out-of-the-box report wizard or using Visual Studio. The Report wizard helps us to create reports by following a couple of screens where we can select entity and filter criteria for our report with different rendering and formatting options. We can create two type of reports in Visual Studio: SSRS and FetchXML. Custom SSRS reports are supported on CRM on-premise deployments whereas CRM online only supports FetchXML.

Note

You can refer to https://technet.microsoft.com/en-us/library/dn531183.aspx for more details on report development.

Client extensions

We can also extend CRM applications from the Web and Outlook clients. We can also develop custom utility tools for these. Sitemap and Command bar editor add-ons are examples of such applications. We can modify different CRM components such as entity structure, Web resources, business rules, different type of Web resources, and other components. CRM Web services can be utilized to map custom requirements. We can do navigation changes from CRM clients by modifying sitemap and command bar definitions.

Integrated extensions

We can also develop custom extensions in terms of the custom utility and middle layer to interact with CRM using APIs. It can be a portal application or any .NET or non-.NET utility. CRM SDK comes with many tools that help us to develop these integrated applications. We will be discussing custom integration with CRM in a later topic.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.184.200