Introduction

All the world's a game, or it will be soon.  That's the position taken by Jesse Schell in his blog Gamepocalypse Now.  Games appeal to people at an emotional level - they're fun and sometimes addictive.  Wouldn't you like your CRM system to be fun and addictive?  This sample code shows you how to add a social game on top of Microsoft Dynamics CRM 2011 - an Achievements system much like Xbox Live or the badges on Foursquare.

Building the Sample

The code is included in a Visual Studio project for you to peruse.  However, I recommend you simply import Achievements_1_0_0_0.zip into your CRM development organization.  It's an unmanaged solution so that you can read, edit, or delete any code you want.  See Achievements - Concept and Install Guide.docx for details.

  1. Deploy the solution.  Be sure to choose the option to activate workflows.
    • If desired, add the Achievements entity to the Settings area.
  2. Edit the Achievement Categories optionset to include the roles in your organization or the types of achievements you want to grant.
    • Example set 1: “Inside sales”, “Outside sales”, “Marketing”, and “Engineering”
    • Example set 2: “Customer connection”, “Process improvement”, and “Teamwork”
  3. Grant the Achievements Player security role to all necessary users.  Note: you must assign this security role to users directly, not through a team.
  4. Grant the Achievements Czar security role to all necessary users, possibly as a custom team.  Make sure to include yourself, assuming you’re the one who will oversee the creation of new Achievements.  (If you don’t, you won’t get the editable portion of the Achievement form.)
  5. Import or create your Achievements.
    • You will need to host the achievement pictures someplace.  Web resources are one option.  In our deployment, we host the pictures on a team Sharepoint site.
    • The pictures need to be squares, otherwise they’ll be distorted when CRM displays them.
    • Be sure to set the “In Production” bit to true.  Otherwise, the achievements won’t show up.

Description

Achievements and Badges are entities added to the CRM system.  Achievements represent attaining some kind of status, completing some task, or participating in some project.  Badges track which users have earned which achievements.  The image below shows a rough diagram of the data model (SystemUser is 1:N with Badge; Badge is N:1 with Achievement) and the code/HTML files which support each entity.

 

 I gave a video talk about this solution a few months ago.  It was originally hosted here: http://www.xrmvirtual.com/events/xbox_xrm but has since been taken down. A mirror is available at https://github.com/vtbassmatt/XrmAchievementsGame.