Archive for the ‘CRM Mobile’ Category

Building clients for Windows 8 RT

November 10, 2012 Leave a comment

The Microsoft.Xrm.Sdk.dll library provided as part of the Dynamics CRM 2011 SDK makes it easy to write  .NET applications that target the desktop. This library has dependencies on .NET 4.0 and Windows Identity Foundation (WIF), neither of which are available for Windows Phone and Windows 8 RT platforms. Although the WS-Trust protocol used by Dynamics CRM 2011 for authentication is fairly well defined and several folks have built implementations for other languages/platforms, we want to make it easy for you to build amazing applications on these platforms , so a reference implementation of the CRM SDK for these platforms is provided here. Unlike the desktop version, where we only provided you with the binary assembly, we have provided the complete source code, so you should be able to make changes to fit your specific needs.  Please note that this works for Dynamics CRM Online deployments, both Office 365 and Windows Live ID, and for Internet Facing Deployments (IFD). It does not work for Dynamics CRM on-premises deployments using Active Directory authentication.

This code is provided “as is”, so you are responsible for making any fixes.

The rest of this post describes how to use the code to authenticate and send web service requests.

Authenticating to the CRM Web Services

Use ServiceConfigurationFactory to construct a DiscoveryServiceConfiguration or an OrganizationServiceConfiguration object. These classes load the relevant metadata and raise one of these events:

  • MetadataLoaded event if the service metadata has been loaded successfully
  • MetadataLoadFailure for other failure cases, such as when the endpoint is not reachable

Once the metadata has been loaded, you can call the Authenticate method. On completion, the Authenticate methods raise the SignInComplete event. The SignOnCompletedEventArgs object on the event callback contains the returned token in the Result property on successful authentication, and contains a non-null exception in the Error property in the case of failed authentication. You can use the returned token to call CRM web service methods.

Windlows Live ID authentication requires device authentication to be performed first, in which case the authentication flow is AuthenticateDevice -> DeviceSigninComplete event -> Authenticate -> SignInComplete event, which can be achieved as shown below:

  1. Attach to the DeviceSigninComplete event and do the following in the event handler:
    1. Handle any error in device authentication by examining the SignOnCompletedEventArgs.Error property. If there is no error, continue with the following
    2. Attach to the SignInComplete event for the user authentication. In the handler, handle any error/read the returned token
    3. Call Authenticate(ClientCredentials clientCredentials, RequestSecurityTokenResponse deviceSecurityToken) passing in the user credentials and the returned token response from device authentication
  2. Call AuthenticateDevice passing in the device credentials to trigger the authentication flow. The DeviceSigninComplete event triggers the user authentication (achieved by step 1)

Calling the CRM Web Services

  1. If no cached token available, authenticate as shown above, and cache the returned token.
  2. Instantiate either the DiscoveryServiceProxy or the OrganizationServiceProxy object as needed.
  3. Set the SecurityTokenReponse property on the proxy object to the cached token.
  4. Attach to the corresponding completion event for the method to be called. For example, use CreateCompleted for the Create method, ExecuteCompleted for the Execute method.
  5. Call the web service method on the DiscoveryServiceProxy or OrganizationServiceProxy objects.
Categories: CRM Mobile Tags: ,

CRM 2011 Solutions: Business applications on steroids

September 30, 2010 Leave a comment

Yes! The Microsoft Dynamics CRM 2011 beta was just released and with one of the hallmark features of our extensibility story: “Solutions Management.”

Remember how extensible previous versions of CRM were? Well, we took that to a whole new level. With CRM 2011 you can define, transport, deploy, maintain and consume full business application built entirely on the CRM framework in days (some core pieces even in hours) and not months. With just a couple of clicks you can declaratively define your data model, processes, user interface and analytics. Advanced extensions such as .Net plug-ins and SRS reports can also be included as part of CRM solutions. All transported and deployed with a uniform model.

Ok, big deal. So CRM 2011 allows me to bundle components and treat team as a “solution”–what is so great about that? That is the key point. It is not just about bundling components but about the fact that the platform now understands the boundaries of a solution and performs intelligent actions accordingly, keep on reading.

Developing and Distributing Solutions while controlling customizations (unmanaged and managed)

The first thing that will strike most newcomers and savvy CRM4 developers is that we introduced the notion of unmanaged and managed solutions. Think of unmanaged solutions as the “source” code of your system and “managed” solutions as the compiled version of your solution. Of course you shouldn’t take this literally because some components in CRM are just “definitions” and don’t require to be compiled; nevertheless the analogy is useful. So, when you initially create a solution it always gets created as unmanaged, you can create new components and perform modifications to others. You can even define some restrictions to ease maintainability of your solution such as setting some components as not customizable.

When the solution is ready for final distribution you export it as managed. When customers install a managed solution we enforce any restrictions that you set (for example prevent customizations on components marked as not customizable). And here is the kicker, while the solution itself cannot be modified, customizable components can still be customized but the system will track those customizations as modification “on top” of the managed solution. So you have the best of both worlds, you can restrict customization of some component while still have built-in extensibility for others without the need to write a single line of code!

Smart updates

But wait a minute, this is a slippery slope. If you allow customers to change your solution (build on top) it will be a nightmare for you to maintain right? Well, not really, we take care of that for you. Whenever you deploy updates to a managed solution the framework automatically preserves customizations performed on top. We have 2 fundamental conflict resolution strategies (merge and preserve) that I’ll explain in subsequent posts but the net result is that customers maintain their customizations while you still deploy your updates.

Automatic Dependency tracking

Gee, but how are you supposed to keep track of what components are used where and not to accidentally delete one that would break another; the problem explodes if you allow customers to further customize your solution. Worry not, because the solutions framework automatically keeps track of all dependencies in the system, isn’t that fantastic?

Build once, deploy everywhere

Solutions built on top of the CRM framework are transportable across all CRM deployment types (Online, Partner Hosted, On-Premises) and all CRM clients (Web, Outlook, Mobile). Truly it is as close as it gets to the holy grail of developers “code once, deploy/use everywhere”. Oh yes, did I mention that we can also take your solutions “Offline” on the outlook client; how many frameworks offer you that kind of functionality?

Solution co-existence

So far so good but what if the user installs multiple solutions from different vendors, aren’t they are going to step into each other toes? No problem, the solution framework automatically handles co-existence of 2 or more solutions when they are installed as managed. The solutions do have to make sense to consume together; while it is technically possible to install two solutions for different verticals (for example Hospital Management and Education Management) into the same organization/tenant the outcome would probably not make a lot of sense for end users, particularly if both solutions want to perform modifications to the same shared component. (For example one wants to turn Account into Hospital while the other one wants to turn Account into School).

Microsoft Dynamics Marketplace

Oh yes, we have a marketplace for you to host your applications that has built-in integration with the product. I’m not going to mention details here because I know for a fact that a lot more information is coming but stay tuned, this is a big deal. 🙂

Go build CRM solutions!

Ready to get started? Take a look at the SDK (I recommend reading topics in full rather than using discrete search) and get going!

Solutions Management is a vast topic, I wrote a 20+ pages document explaining the fundamentals, patterns and variations which we are in the process of incorporating into the SDK. While you can get up and going building your first solution in just a couple of minutes mastering more advance topics does take some time, so don’t get baffled, you’ll get there. Trust me, the more your learn the more “ohhhh!” moments you will have; I’ve seen it first hand with some early adopters J

A note about the team behind

Nothing else and nothing more than 40+ people were directly (actually hands-on) on the design and development of the solutions framework and related components. Attempting to name each one would inevitably lead me to miss someone but I do want to show my greatest respect and gratitude to the solutions “platform” team that built the foundation that everything else is built upon. They are (in no particular order): Scott Head, Ajith Gande, Atul Shenoy, Donald La, Christian Betrisey, Brandon Simons, Greg Alicbusan, Jim Daly, Carola Klass, and Elliot Lewis. Special thank you to satellite teams: Application Infrastructure, Visualizations, Reporting and Programmability. You guys rock!

Humberto Lezama Guadarrama

Tip o’ the Day: Quick Codeless Auditing Tool

August 18, 2010 Leave a comment

The workflows in Microsoft Dynamics CRM 4.0 are very powerful. Here is an example of an auditing tool which can be implemented without code, without additional attributes or additional entities and if you just need an audit log to roll back when people make mistakes, it should do the job.

Step 1: Setting up the Workflow

The workflow is pretty simple. All you do is create a note when a new record is created or when a specific field is changed.

In this case I’m auditing the first name attribute of the Contact record. The details of the note are thus:

That’s 90% of the work now done. We publish and the engine is in place.

Step 2: Make some changes

When we create a new contact or change the ‘First Name’ field, a new note will be created against the contact showing the current value. To determine the previous value we look back through the notes.

If there are extensive notes, we can use Advanced Find

We can even save the Advanced Find as a View and while there is no simple way to access the log through the interface, we can always go to Advanced Find – Saved Views.

Each time you need to audit a new field you just create a new workflow. If you are monitoring many fields, a plug-in may be a better option but if you need an audit tool to manage a few key fields and don’t want to spend a lot of time messing about, this should do the trick.


Leon Tribe

Microsoft Dynamics CRM Resource Center Redux

The Microsoft Dynamics CRM Resource Center for 4.0 and Online has become a very popular place to find information. The following tables highlight the top videos for CRM Online and CRM On Premises last month.


CRM Online: Top 5 Videos in June
Accept an invitation to Microsoft Dynamics CRM Online
Account basics
Take a tour of Microsoft Dynamics CRM
Importing customer data
Getting started with leads


CRM On Premises: Top 5 Videos in June
Set up your product catalog
Work with mail merge and mail merge templates
Create a simple workflow
Create and apply e-mail templates
Create and run duplicate detection rules


It is also worth noting that the Resource Center for CRM Online was successfully published into three new languages:

A big thanks to Andrew Becraft, Amy Langlois, Satish Kadam, Josh Chang, the Editing team, SE and Service Delivery team, and the Localization team for all your hard work and perseverance. (And to anyone else who I’ve forgotten to mention. Thank you!)

Renee Wesberry

Connect your SDK application to Microsoft Dynamics CRM Online

Until recently, applications that connected to CRM Online were required to use certificates as part of the authentication process. Only a limited set of certificates were supported and there was a cost to buy the certificate.

The latest (R5) version of CRM Online and the CRM 4.0 SDK includes the ability for applications to connect to the server and authenticate without using certificates. This lightweight authentication feature enables you to authenticate with CRM Online using Windows Live ID user logon information (username, password) and device information (device ID, device password).

Two new CRM 4.0 SDK samples are now available that demonstrate this new authentication technique. One sample demonstrates the basic technique while the other adds the ability to impersonate a CRM user. Through impersonation you can perform an operation in CRM on behalf of another user.

These samples can be downloaded from Code Gallery.

The latest version of the CRM 4.0 SDK can be downloaded from the Microsoft download site.


Peter Hecke

Plug-ins vs. Workflows in Microsoft Dynamics CRM

I frequently get this question: When should I write a plug-in in Microsoft Dynamics CRM versus a workflow ? This dilemma is faced whenever custom logic must be executed in a pre and/or post operation.

Peter Hecke of Microsoft created this decision table on MSDN. Here is another pretty cool matrix done by Humberto on how to choose between these options: Additionally, I would like to point out some stuff that could also help when making up your mind.

First of all, remember than both workflows and plug-ins can attach to exactly the same events. Well, plug-ins have available a couple of more events but essentially both work on top of the same event model.Remember also that workflows always run asynchronous and hence, the Asynchronous Processing Service must be running on the server in order to run.

Workflows are more suitable if:

  • you want to achieve simple tasks faster, such as sending an e-mail or creating / updating assigning records. These actions can be set up very quickly with a workflow without any need of writing code.
  • you want to easily scale things to managers (if they were setup for user records), as it is possible to assign records to them.
  • you want to allow an advanced user to make changes to logic. As using the integrated workflow designer is user-friendly, an advanced user would be able to edit an existing workflow and change some rules according to business changes.
  • the logic should be available to be run on demand. I mean, when you are within an entity and navigates to “workflows” option in the left pane, all workflows marked as available to run on demand can be executed making them independent of an event trigger.
  • you want to send emails making use of templates and attaching files.

Workflows also allow running child workflows which may make a lot of sense in some scenarios. Nevertheless, be careful if you need the child workflow results in order to make decisions on your main workflow, as child workflows always run asynchronous, which means that it will trigger the child workflow and continue. If you need your primary workflow to wait until child ends, you will need to write a custom activity.

On the other hand, plug-ins are more suitable if:

  • you need to manipulate data before is saved.
  • you need to make validations before submitting the operation.
  • you want to be able to cancel an operation based on your validations.
  • immediate response to the user is needed.
  • you need retrieve values and/or take actions after operation has been completed (i.e. getting and autogenerated id)

It is important to note that since Dynamics CRM 4, plug-ins can also be configured to run asynchronous (Mode attribute while registering plug-in). Nevertheless, pre-event asynchronous plug-ins are not supported. In this case, you will have to set it up as synchronous mode.

Another important thing about plug-ins is the Deployment option which says if the plug-in is going to be executed on the server and/or Outlook client. If both executions are set up and client goes offline and online, plug-in calls are triggered after synchronization so be prepared in this case to execute your code twice!

Regarding to security:

  • Workflows triggered automatically will run under the security context of the workflow owner. On the contrary, if executed on demand, the security context of the user who executed the workflow will be used.
  • Plug-ins execute under the security context of the CRM Web application pool identity (typically NETWORK SERVICE). As this account typically maps to generic CRM SYSTEM user this typically works fine.

However, within plug-ins you can make use of impersonation to work under the credentials of the user who is making the request. For doing so, you just need to pass True to the CreatCrmService method under the context object.If you need to always impersonate with a specific user, you can do that by passing True as above and setting impersonatinguserid attribute while registering the plug-in.It is important to know that plug-in impersonation does not work offline. The logged on user credentials are always used in this case.

Hope it helps to clarify this dilemma and make better decisions.

Pablo Peralta

A Health Plan Sales Solution for Microsoft Dynamics CRM

LAS VEGAS — June 10, 2010 — Microsoft Corp. today announced at America’s Health Insurance Plans (AHIP) Institute 2010 the Health Plan Sales Solution for Microsoft Dynamics CRM, a strategic sales and service-enabled customer relationship management (CRM) platform that will allow health plans to quickly and easily move their marketing and sales processes online to better manage and monitor sales, member service and retention. As a result, health plans will be able to better compete in the individual and small-group market, reduce multiple points of failure in their current sales, service and retention processes, and interoperate with state health insurance exchanges.

The Congressional Budget Office estimates that health reform will expand coverage to 32 million by 2019 and 24 million will be enrolled through exchanges by 2019, not counting employer coverage, meaning health plans need to quickly take advantage of this short window of growth or risk losing share and revenue to competitors. According to a recent Gartner report, “Health insurers that do not have effective online sales and service functionality for the individual market must immediately establish such capabilities to compete in the current market and meet future requirements of exchanges.”*

“In light of changing regulations, health plans must now focus on winning share and loyalty through adaptive and efficient sales processes and exceptional customer experience while preparing to integrate sales and service processes with each health insurance exchange in 2014,” said Dennis Schmuland, director, U.S. Health Plans Industry Solutions, Microsoft. “Through a comprehensive CRM strategy that is pre-integrated with various touch points in the sales process, our Health Plan Sales Solution for Microsoft Dynamics CRM enables insurers to easily and quickly capture critical sales data, reduce the cost of sales, service, and retention, and interoperate with state health insurance exchanges by 2014.”

The Health Plan Sales Solution for Microsoft Dynamics CRM is an interoperable framework that allows for more seamless integration with existing systems and applications. Partners can pre-integrate their solution to offer health plans a seamless workflow across different applications, and a number of Microsoft’s trusted partners, including Ingenix, CosmoCom Inc., VUE Software and Colibrium Partners LLC, are already supporting this framework.

The platform enables insurers to more easily design and deploy a complete CRM strategy that spans acquisition, retention, health and care management, and service, and it tightly integrates social media sites into the sales, service and retention processes. With the platform, payers also will be able to reduce custom legacy integration costs and maximize their existing investment in both Microsoft and non-Microsoft technologies. In addition, the Microsoft Dynamics CRM solution can be deployed wholly on-premise, in Microsoft’s cloud computing platform, or as a hybrid solution that provides the flexibility, improved security and cost management that health plans want.

“Health insurance is an increasingly complex and challenging environment to work within because of the ever-shifting regulatory, patient and business landscape, which directly impacts our underwriting efforts,” said Jeff Berry, vice president, Underwriting, Blue Cross and Blue Shield of Kansas City. “By deploying the Tuo product suite integrated with Microsoft Dynamics CRM, we will be able to quickly expand and change underwriting methodologies as the market shifts without costly development efforts. This will help us achieve significant efficiencies, which directly benefit our customers.”

Read more…