You are previewing Programming Microsoft Dynamics® CRM 4.0.
O'Reilly logo
Programming Microsoft Dynamics® CRM 4.0

Book Description

Get answers to common questions about setting up the design environment and building custom solutions with Microsoft Dynamics CRM. Delve into core architecture, tools, and techniques, and learn how to exploit powerful customization features. Authored by industry-leading experts, this book shows how to deliver intelligent CRM solutions that meet the unique challenges and requirements of your business.

Discover how to:

  • Set up the development environment

  • Enhance the product’s APIs with your own code

  • Execute business logic using plug-ins

  • Build custom workflows that extend native workflow functions

  • Create user-friendly integration with scripts and application extensions

  • Code custom pages optimized for Microsoft Outlook with Offline Access

  • Extend Microsoft Dynamics CRM using ASP.NET

  • Create advanced Windows Workflow Foundation solutions

  • Extend multilingual and multicurrency features

  • Construct a custom security-access solution

  • Get code samples on the Web.

    Table of Contents

    1. Programming Microsoft Dynamics® CRM 4.0
      1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
      2. Foreword
      3. Acknowledgments
        1. Jim Steger’s Acknowledgments
        2. Mike Snyder’s Acknowledgments
        3. Brad Bosak’s Acknowledgments
        4. Corey O’Brien’s Acknowledgments
        5. Philip Richardson’s Acknowledgments
      4. Introduction
        1. Who This Book Is For
        2. What This Book Is About
        3. Companion Content
        4. System Requirements
          1. Client
          2. Server
        5. Find Additional Content Online
        6. Support for This Book
          1. Questions and Comments
      5. I. Overview
        1. 1. Microsoft Dynamics CRM 4.0 SDK Overview
          1. Software Development Kit Introduction
          2. Hitchhiker’s Guide to Common Questions
            1. Can we alter the CRM database structure to add our custom tables and columns?
            2. How do we write custom code that gets data into and out of Microsoft Dynamics CRM?
            3. Can we change the current CRM form layouts and controls?
            4. How do we implement our own custom business logic?
            5. How much control do we have over the user interface and branding?
            6. How do we deploy changes from one system to another?
            7. Will our customizations upgrade when Microsoft releases a new version of the software?
            8. Are role-based security permissions supported and configurable?
            9. Does Microsoft Dynamics CRM support multiple languages and currencies?
            10. Will our programming customizations run offline?
            11. How do you recommend we set up a Microsoft Dynamics CRM development environment?
          3. Microsoft Dynamics CRM as a Business Application Platform
          4. Summary
        2. 2. Development Overview and Environment
          1. Microsoft Dynamics CRM 4.0 System Overview
            1. Microsoft Dynamics CRM 4.0 Versions
            2. Microsoft Dynamics CRM Components
            3. Licensing
            4. Server Roles
          2. Hardware Requirements
            1. Microsoft Dynamics CRM 4.0 Web Server Requirements
            2. Virtualization
          3. Development Environment
            1. Server Environment Development Options
              1. Isolated Development Environment
              2. Sharing a Common Microsoft Dynamics CRM Organization
              3. Using a Hybrid Environment
              4. Using Different Organizations in a Single Microsoft Dynamics CRM Deployment
            2. Developing Customizations Accessed From Outlook
          4. Testing Environment Considerations
          5. Migrating Data
            1. Native Microsoft Dynamics CRM Import
            2. Data Migration Manager
            3. Third-Party Tools
            4. Custom Code
          6. Redeployment
          7. Development Tools
            1. Integrated Development Environment (IDE)
            2. Source Control
            3. Continuous Integration Tool
            4. Installer
            5. Additional Development Utilities
          8. Additional Development Considerations
          9. Summary
        3. 3. Communicating with Microsoft CRM APIs
          1. Overview of the Microsoft Dynamics CRM 4.0 SDK
          2. Accessing the APIs in Visual Studio 2008
          3. CrmService Web Service
            1. Authentication
              1. Authenticating to the API Services
              2. Configuring the Security Token
              3. Understanding the Security Context of a Method Call
            2. Common Methods
            3. Execute Method
            4. Request and Response Classes
            5. DynamicEntity Class
            6. Attributes
          4. MetadataService Web Service
          5. CrmDiscoveryService Web Service
          6. Connecting to Microsoft Dynamics CRM IFD
          7. Connecting to Microsoft Dynamics CRM Offline
          8. Connecting to Microsoft Dynamics CRM Online
          9. Summary
      6. II. Extending Microsoft CRM
        1. 4. Security
          1. Role-Based and Object-Based Security
          2. Security Principals
          3. Access Rights
          4. Impersonation
            1. Impersonation for Web applications
            2. Impersonation for Plug-ins
          5. Using the Microsoft Dynamics CRM SDK to Perform Security-Related Operations
            1. Programmatically Creating a Security Role and Adding Privileges
            2. Programmatically Assigning a Security Role
            3. Retrieving Roles and Privileges
            4. Sharing Records
            5. Assigning Records
          6. Using Direct SQL for Accessing Microsoft Dynamics CRM Data
            1. Determining the Organization’s Connection String
            2. Filtered Views
            3. Additional Programming Considerations with Filtered Views
          7. Data Encryption
            1. One-Way Encryption
            2. Two-Way Encryption
          8. Summary
        2. 5. Plug-ins
          1. Writing Your First Plug-in
            1. Creating the Plug-in Project
            2. Implementing the Plug-in Class
            3. Building the Registration Tool
            4. Deploying the Plug-in
              1. Mode
              2. Stage
              3. Deployment
              4. Messages
              5. Entities
              6. Rank
              7. Assembly Location
              8. Images
          2. The Event Execution Pipeline
            1. Supported Messages and Entities
            2. Parent and Child Pipelines
          3. IPluginExecutionContext
          4. Impersonation
            1. Impersonation During Registration
            2. Impersonation During Execution
          5. Exception Handling
            1. Exceptions and the Event Processing Pipeline
            2. Exception Feedback
          6. Deployment
            1. Plug-in Entities
            2. Programmatic Plug-in Registration
            3. Images
            4. Programmatic Image Registration
            5. Custom Configuration
            6. Deploying Referenced Assemblies
          7. Debugging Plug-ins
            1. Remote Debugging
            2. Logging
          8. Unit Testing
            1. Mock Objects
            2. Test Frameworks
            3. Sample Test
          9. Sample Plug-ins
            1. Rolling Up Child Entity Attributes to a Parent Entity
            2. System View Hider
            3. Customization Change Notifier
          10. Summary
        3. 6. Programming Workflow
          1. Overview
          2. The Workflow Designer
            1. Testing the Workflow
            2. Workflow Definitions
              1. Automatic Workflows
              2. Manual Workflows
              3. Child Workflows
              4. Workflow Steps
            3. Dynamic Values in Workflow
              1. Operator
              2. Look for Options
              3. Dynamic Values Box
              4. Default Value
          3. Windows Workflow Foundation
            1. Activities
            2. Dynamic Value Binding
          4. Custom Workflow Activities
            1. Implementing a Custom Activity
            2. Deploying the Custom Assembly
              1. Registration with the PluginRegistration Tool
              2. Programmatic Custom Activity Registration
            3. Testing the Custom Activity
            4. Investigating Custom Activity Errors
            5. CRM Workflow Attributes
            6. Workflow Context
            7. Entity Images in Custom Workflow Activities
              1. Creating an Entity Image Debugging Activity
              2. Using the DebugEntityImagesActivity
            8. Workflow Designer Limitations
          5. Example Activities: Math Building Blocks
          6. Example Activity: Retrieve Most Available User
          7. Example Activity: Calculate Related Aggregate
          8. Summary
        4. 7. Form Scripting
          1. Form Scripting Overview
            1. Understanding Client-Side Scripting with Microsoft Dynamics CRM
            2. Referencing Microsoft Dynamics CRM Elements
            3. Available Events
          2. Calling Web Services from Script
          3. Using the CRM API SOAP Request from Script
          4. Testing and Deployment
            1. Debugging JavaScript
            2. Additional Testing and Debugging Tips
          5. Scripting from ISV.Config Buttons
          6. Advanced Topics
            1. Form Type Considerations
            2. Cross-Site Scripting (XSS)
            3. Using Script for Validation
            4. Loading External JavaScript Files
          7. Scripting Examples
            1. Display Customer Information in a ToolTip
            2. Setting the Form’s Title at Run Time
            3. Enhancing the Form’s Display
          8. Summary
        5. 8. Developing with the Metadata Service
          1. Connecting to the MetadataService
            1. Referencing the MetadataService
            2. Locating the Endpoints
              1. Application Settings
              2. Discovery Service
              3. Plug-ins
              4. Offline
              5. Using the MetadataService with the CrmImpersonator Class
              6. 2006. Endpoint
            3. Microsoft Dynamics CRM Security
          2. Retrieving Metadata
            1. Names Used in the MetadataService
            2. Retrieving Entities
              1. RetrieveEntityRequest
              2. RetrieveAllEntitiesRequest
            3. Retrieving Attributes and Relationships
              1. Attribute Considerations
              2. Relationship Considerations
            4. Multilingual Strings
              1. Available Languages
          3. Remote Customization
            1. Entities
              1. Creating Entities
              2. Updating Entities
              3. Deleting Entities
            2. Attributes
              1. Display Masks
              2. Picklists
            3. Relationships
              1. One-to-Many Relationships
              2. Many-to-Many Relationships
              3. Relationship Eligibility Messages
            4. Publishing Metadata
          4. Caching the Metadata
            1. Using the Timestamp
            2. Example File System Cache
          5. Handling Errors
          6. Summary
      7. III. Advanced Topics
        1. 9. Deployment
          1. Common Deployment Steps
            1. Build
            2. Install
            3. Configure
            4. Uninstall
              1. Removing the Solution Components
              2. Deleting Metadata and Transactional Data
          2. Deploying Microsoft Dynamics CRM Components
            1. Customizations
              1. Importing Customizations
              2. Using the MetadataService
              3. Publish Customizations
              4. Importing the Organization
            2. Workflow Rules, Templates, and Security Roles
            3. User Interface Changes (Forms, ISV.Config, and Sitemap)
            4. Custom Web Pages
            5. Plug-in and Workflow Assemblies
            6. Online Help
            7. Custom Reports
            8. Configuration Settings
          3. Offline Application Deployment
            1. Offline Web Applications
            2. Plug-in Allow List
          4. Testing Strategies
            1. Server Topologies
            2. Operating Systems
            3. Web Browsers
            4. Database Servers
            5. Authentication
            6. Multi-Tenant
            7. Multilingual
            8. Accessibility
          5. Additional Deployment Considerations
            1. Missing Prerequisites
            2. Resetting IIS
            3. Customizations Management
          6. Example Deployment Sequence
            1. Component Inventory
            2. Build
            3. Install
            4. Configuration
            5. Uninstall
          7. Summary
        2. 10. Developing Offline Solutions
          1. Overview
          2. Offline Development Environment
            1. Workstation
            2. Laptop
            3. Virtual PC
          3. Offline Navigation
            1. Client Attribute
            2. AvailableOffline Attribute
          4. Communicating with the Microsoft Dynamics CRM SDK API Offline
            1. CrmService Offline
              1. Offline Message and Entity Availability
              2. Creating a CrmService Instance Offline
            2. MetadataService Offline
            3. Microsoft Dynamics Outlook SDK
          5. Scripting for Offline
          6. Developing Iframes for Offline
            1. Programming the IFrame
            2. Deploying the IFrame Page
              1. Microsoft Dynamics CRM Customizations
              2. Microsoft Dynamics CRM Web Server
              3. Microsoft Dynamics CRM for Outlook with Offline Access
            3. Testing the IFrame Page Offline
          7. Developing an Offline Plug-in
            1. Programming the Plug-in
            2. Deploying the Plug-in
            3. Testing the Plug-in
          8. Offline Development Considerations
          9. Summary
        3. 11. Multilingual and Multi-Currency Applications
          1. Programming for Multilingual Applications
            1. CrmService Messages for Multilingual Support
              1. Exporting and Importing Translations
            2. Using the Metadata Service for Multilingual Applications
              1. Programming the Multilingual IFrame
              2. Deploying and Testing the Multilingual IFrame
            3. Using Resource Assemblies for Multilingual Strings
              1. Updating the Multilingual IFrame with Resource Files
              2. Deploying and Testing the Updated IFrame
          2. Programming for Multi-Currency Applications
          3. Summary
        4. 12. Advanced Workflow Programming
          1. Custom Workflow Manager Tool
          2. Workflows as Entities
            1. The workflow Entity
            2. Interacting with Workflows Through CrmService
            3. Workflow Publication
            4. The workflowdependency Entity
            5. Retrieving Workflow Dependencies
          3. Declarative Workflows
            1. XAML Syntax
            2. XAML in Microsoft Dynamics CRM
            3. Creating Your First Declarative Workflow
            4. Declarative Workflow Deployment
            5. Examining Native Workflow XAML
            6. Exporting Workflows Programmatically
          4. Summary
        5. 13. Emulating User Interface with ASP.NET Development
          1. IFrame Development
            1. Programming the IFrame
              1. Populating the Form
              2. Handling a Form Submit
            2. Deploying and Testing the IFrame
          2. Dialog Box Development
            1. Programming the Dialog Box
            2. Deploying and Testing the Dialog Box
          3. ISV Page Development
            1. Programming the ISV Page
            2. PopulateLeadTable and PopulateOpportunityTable
            3. PopulateActivityTable Method
            4. Deploying and Testing the ISV Page
          4. Summary
        6. 14. Developing Custom Microsoft CRM Controls
          1. Overview
          2. CrmPicklistControl
            1. Programming the CrmPicklistControl
              1. CrmPicklistControl Properties
              2. Adding Options to the CrmPicklistControl
            2. Testing the CrmPicklistControl
          3. CrmBooleanControl
            1. Programming the CrmBooleanControl
              1. CrmBooleanControl Properties
              2. Adding Options to the CrmBooleanControl
            2. Testing the CrmBooleanControl
          4. CrmDateTimeControl
            1. Programming the CrmDateTimeControl
              1. CrmDateTimeControl Properties
              2. Adding the Child Controls
              3. Creating the Calendar Pop-Up
            2. Testing the CrmDateTimeControl
          5. CrmEntityPicklistControl
            1. Programming the CrmEntityPicklistControl
              1. CrmEntityPicklistControl Properties
              2. Binding the Data
            2. Testing the CrmEntityPicklistControl
          6. CrmGridViewControl
            1. Programming the CrmGridViewControl
              1. CrmGridViewControl Properties
              2. Adding the Columns
              3. Creating the CrmGridViewTemplate
              4. Creating the DataSource
              5. Updating the Record in Microsoft Dynamics CRM
            2. Testing the CrmGridViewControl
          7. Summary
        7. 15. Additional Samples and Utilities
          1. Utility Classes
            1. MetadataUtility Class
          2. Customizations Utility
          3. Additional Script Samples
            1. Conditionally Enabling Attributes
            2. Hiding Navigation Links on a Form
          4. Field-Level Security
            1. Hiding Tabs and Fields on a Form
              1. Hiding a Tab
              2. Hiding and Showing a Field and Label
            2. Field-Level Security Script
            3. Field-Level Security Script Example
          5. Summary
      8. A. About the Authors
        1. Jim Steger
        2. Mike Snyder
        3. Brad Bosak
        4. Corey O’Brien
        5. Philip Richardson
      9. B. About Sonoma Partners
      10. C. Additional Resources for Developers from Microsoft Press
        1. Visual Basic
        2. Visual C#
        3. Web Development
        4. Data Access
        5. .NET Framework
        6. Other Developer Topics
      11. D. More Great Developer Resources
        1. Developer Step by Step
        2. Developer Reference
        3. Focused Topics
      12. Index
      13. SPECIAL OFFER: Upgrade this ebook with O’Reilly