You are previewing Inside Microsoft Dynamics® AX 2009, Second Edition.
O'Reilly logo
Inside Microsoft Dynamics® AX 2009, Second Edition

Book Description

Dig into the architecture and internals of Microsoft Dynamics AX with firsthand insights from the team who designed and developed it. Deepen your knowledge of the underlying frameworks, components, and tools and get best-practice guidance to customize and extend your own high-performance solutions. Discover how to: Work with MorphX application-modeling tools and X++ code Exploit built-in workflow infrastructure to simplify process automation Use Enterprise Portal and ASP.NET to build rich, role-based Web portals See how reporting components work together for better business intelligence Execute complex batch jobs with greater control and reliability Learn how the runtime implements configuration and security Walk through integration scenarios and technologies Create and expose services to external applications Optimize application performance and extensibility.

Table of Contents

  1. Inside Microsoft Dynamics® AX 2009
  2. Foreword
  3. Acknowledgments
  4. Introduction
    1. Who Is This Book For?
    2. The History of Microsoft Dynamics AX
    3. Organization of This Book
    4. Reading Guide
      1. Differences from Inside Microsoft Dynamics AX 4.0
      2. Product Documentation
      3. Product Web Site
      4. Naming
      5. Code
      6. Glossary
      7. Special Legend
    5. System Requirements
    6. Release Software
    7. Technology Updates
    8. Code Samples
    9. Bonus Content
    10. Find Additional Content Online
    11. Support for This Book
    12. Questions and Comments
  5. I. A Tour of the Development Environment
    1. 1. Architectural Overview
      1. Introduction
      2. Design Philosophy and Benefits
      3. Application Development and Runtime Configurations
        1. Rich Client Application
        2. Web Client Application
        3. Integration Client Application
      4. Architecture of Dynamics AX
        1. Development Environments
          1. Application Modeling
        2. Logic Elements and Data Elements
        3. Application Frameworks
        4. Runtime Environments
        5. Communications
        6. Model Layering
        7. Licensing, Configuration, and Security
        8. Database Layer
      5. Application Model Layering System
        1. Working with the Layers
        2. Model Element IDs
      6. Application Frameworks
        1. RunBase Framework
        2. Batch Framework
        3. Dialog Framework
        4. Operation Progress Framework
        5. Number Sequence Framework
        6. SysLastValue Framework
        7. Application Integration Framework
        8. Wizard Framework
        9. Infolog Framework
      7. Enterprise Portal and Web Parts
      8. Reporting Framework
      9. Operations Environment
    2. 2. The MorphX Development Environment
      1. Introduction
      2. Developing with MorphX
        1. Planning Phase
        2. Design Phase
        3. Implementation Phase
        4. Stabilization Phase
        5. Release Phase
      3. Application Model Elements
        1. Operational and Programming Model Elements
          1. Operational Model Elements
          2. Programming Model Elements
        2. Value Type, Database, and Data Association Model Elements
          1. Value Type Model Elements
          2. Database Model Elements
          3. Data Association Model Elements
        3. Class Model Elements
        4. Presentation Model Elements
          1. Rich Client Model Elements
          2. Web Client Model Elements
    3. 3. The MorphX Tools
      1. Introduction
      2. Application Object Tree
        1. Navigating the AOT
        2. Creating New Elements in the AOT
        3. Modifying Elements in the AOT
        4. Refreshing Elements in the AOT
        5. Element Actions in the AOT
        6. Element Layers in the AOT
      3. Project Designer
        1. Creating a New Project
        2. Automatically Generated Projects
          1. Group Masks
          2. Filters
          3. Development Tools
          4. Layer Comparison
          5. Upgrade Projects
        3. Project Types
      4. Property Sheet
      5. X++ Code Editor
        1. Shortcut Keys
        2. Editor Scripts
      6. Label Editor
        1. Creating a New Label
        2. Referencing Labels from X++
      7. Visual Form Designer and Visual Report Designer
        1. Visual Form Designer
        2. Visual Report Designer
      8. Code Compiler
      9. Dynamics AX SDK
      10. Best Practices Tool
        1. Understanding Rules
        2. Suppressing Errors and Warnings
        3. Adding Custom Rules
      11. Debugger
        1. Using the Debugger
        2. Debugger Interface
          1. Main Window
          2. Variables Window
          3. Call Stack Window
          4. Watch Window
          5. Breakpoints Window
          6. Output Window
          7. Status Bar
          8. Debugger Shortcut Keys
      12. Visio Reverse Engineering Tool
        1. UML Data Model
        2. UML Object Model
        3. Entity Relationship Data Model
      13. Table Browser Tool
      14. Find Tool
      15. Compare Tool
        1. Starting the Compare Tool
        2. Using the Compare Tool
        3. Compare APIs
      16. Cross-Reference Tool
      17. Version Control
        1. Element Life Cycle
        2. Check-Out
        3. Undo Check-Out
        4. Check-In
        5. Quality Checks
        6. Updating Source Code Casing
        7. Creating New Elements
        8. Renaming Elements
        9. Deleting Elements
        10. Labels
        11. Get Latest
        12. Synchronization
        13. Synchronization Log
        14. Show History
        15. Revision Comparison
        16. Pending Elements
        17. Build
        18. Integration with Other Version Control Systems
      18. Unit Test Tool
        1. Test Cases
        2. Test Suites
        3. Test Projects
        4. The Test Toolbar
        5. Code Coverage
        6. Test Listeners
        7. Object Model
    4. 4. The X++ Programming Language
      1. Introduction
      2. Jobs
      3. The Type System
        1. Value Types
        2. Reference Types
        3. Type Hierarchies
          1. The anytype Type
          2. The common Type
          3. The object Type
          4. Extended Data Types
      4. Syntax
        1. Variable Declarations
        2. Expressions
        3. Statements
          1. Data-Aware Statements
          2. Exception Handling
          3. Interoperability
          4. CLR Interoperability
          5. COM Interoperability
        4. Macros
        5. Comments
        6. XML Documentation
      5. Classes and Interfaces
        1. Fields
        2. Methods
      6. Code Access Security
      7. Design and Implementation Patterns
        1. Class-Level Patterns
          1. Parameter Methods
          2. Constructor Encapsulation
          3. Serialization with the pack and unpack Methods
          4. Observers and Listeners
        2. Table-Level Patterns
          1. Find and Exists Methods
          2. Polymorphic Associations
          3. Generic Record Reference
  6. II. Core Development Concepts
    1. 5. Customizing Dynamics AX
      1. Introduction
      2. Table and Class Customization
        1. Creating New Dimension Types
        2. Adding New Dimensions to a Table
        3. Enabling New Dimensions in Forms
        4. Customizing Other Tables
        5. Adding Dimensions to Queries
        6. Adding Lookup, Validation, and Defaulting X++ Code
      3. Form Customization
        1. Learning Form Fundamentals
          1. Customizing with Metadata
            1. Metadata associations
            2. Metadata inheritance
            3. Menu definitions
            4. Important metadata properties
            5. Image metadata
          2. Customizing with Code
        2. Displaying an Image
        3. Displaying an Image on a Form
          1. Displaying an Image by Using Joined Data Sources
          2. Displaying an Image When Activating the Image Tab
      4. Report Customization
        1. Creating Promotional Materials
        2. Adding Promotional Materials to an Invoice Report
          1. Implementing Promotional Methods
          2. Binding Display Methods to Report Controls
          3. Preventing Printing of an Empty Body Section
      5. Number Sequence Customization
    2. 6. Extending Dynamics AX
      1. Introduction
      2. Wizard Framework Extension
        1. Creating a New Wizard
        2. Creating Labels
        3. Adding Content to the Wizard
        4. Adding the Wizard to the Navigation Pane and the Area Page
        5. Creating a Default Data Wizard
      3. RunBase Framework Extension
        1. Inheritance in the RunBase Framework
        2. Property Method Pattern
        3. Pack-Unpack Pattern
          1. pack and unpack Methods
        4. Bike-Tuning Service Offers Example
          1. Creating the Labels
          2. Creating the Table
          3. Creating the Class
          4. Implementing the Class Description
          5. Implementing Constructors
          6. Implementing a User Dialog Box
          7. Implementing the run Method
          8. Implementing the pack and unpack Methods
          9. Creating a Menu Item
        5. Adding Property Methods
        6. Adding Constructors
        7. Adding a Query
        8. Client/Server Considerations
    3. 7. Enterprise Portal
      1. Introduction
      2. Inside Enterprise Portal
      3. Page Processing
      4. New Features in Dynamics AX 2009 Enterprise Portal
      5. Enterprise Portal Development Tools
        1. MorphX
        2. Visual Studio
        3. Windows SharePoint Services
      6. Developing Data Sets
      7. Developing Web User Interface Components
        1. AxDataSource
        2. AxGridView
        3. ContextMenu
        4. AxFilterControl
        5. AxForm
        6. AxMultiSection
        7. AxSection
        8. AxGroup
        9. AxLookup
        10. AxToolbar
        11. AxPopup
        12. BoundField Controls
        13. Web Parts
      8. Programming Enterprise Portal Controls
        1. AJAX
        2. Session
        3. Context
        4. Data
        5. Metadata
        6. Labels
        7. Formatting
        8. Error Handling
        9. ViewState
        10. Page Life Cycle
        11. Proxy Classes
      9. Securing Web Elements
      10. Developing the Navigation
      11. Web Files
      12. Import and Deploy Page/List Tools
      13. Record Context and Encryption
      14. Security
    4. 8. Role Centers
      1. Introduction
      2. Inside Role Centers
        1. Architecture
      3. Developing Role Centers
        1. Customizing an Out-of-the-Box Role Center
        2. Creating a New Role Center
        3. Role Center Web Parts
          1. Cues
          2. Quick Links
            1. Adding Quick Links
            2. Maintaining Quick Links
          3. Business Overview
            1. Working with Measures
            2. Working with Time Periods
            3. Business Overview Authentication
          4. Unified Worklist
          5. Reports
          6. Role Centers in MOSS
          7. KPI Lists
          8. Filter Web Parts
        4. User Profiles
          1. Associating Users with User Profiles
      4. Kerberos Authentication
      5. Security
    5. 9. Workflow in Dynamics AX
      1. Introduction
      2. Dynamics AX 2009 Workflow Infrastructure
      3. Windows Workflow Foundation
      4. Automating Business Processes
        1. Workflow from a Developer’s Perspective
        2. Key Workflow Concepts
          1. Workflow Document and Workflow Document Class
          2. Workflow Categories
          3. Workflow Templates
          4. Event Handlers
          5. Menu Items
          6. Workflow Elements
          7. Providers
          8. Workflow Configurations
          9. Workflow Instances
          10. Work Items
      5. Workflow Architecture
        1. AOS and IIS Workflow Runtimes
          1. Workflow Runtime Interaction
        2. Logical Approval and Task Workflows
      6. Workflow Life Cycle
        1. Designing Workflows
          1. State Model
          2. Creating a Workflow Category
          3. Creating the Workflow Document Class
          4. Adding a Workflow Display Menu Item
          5. Activating the Workflow
    6. 10. .NET Business Connector
      1. Introduction
        1. Integration Technologies
      2. Inside .NET Business Connector
        1. Logical Component Stack
          1. Managed Classes
          2. Transition Layer
          3. Interpreter
        2. Run Time
        3. Web Interoperability
        4. Security
          1. Authentication
          2. Authorization
          3. Code Access Security
      3. Usage Scenarios for .NET Business Connector
        1. Client
          1. Business Data Lookup Snap for Microsoft Office
          2. PDA Synchronization Example
        2. Web
        3. Server
      4. Working with .NET Business Connector
        1. Data Types and Mappings
        2. Managed Classes
        3. Processing Requests and Responses
          1. Request Processing
          2. Response Processing
        4. Exception Handling
        5. HelloWorld Example
        6. Accessing Data
        7. Querying Data Across Companies
          1. Method 1: Using ExecuteStmt
          2. Method 2: Using the Query Object
        8. Invoking Business Logic
      5. Enhanced CLR Interoperability with the Dynamics AX Interpreter and X++
        1. Passing Managed Objects to Dynamics AX
        2. Registering Managed Callbacks
      6. Migrating Applications
    7. 11. Reporting in Dynamics AX 2009
      1. Introduction
      2. Reporting Overview
        1. What Is a Report?
        2. Reporting and Users
        3. Providing Reports in Dynamics AX 2009
          1. Report Categories
          2. Kinds of Reports in Dynamics AX 2009
          3. Reporting Platforms in Dynamics AX 2009
          4. Report Entry Points
      3. Inside the Dynamics AX 2009 Reporting Framework
        1. Data Flow Overview
        2. Reporting Services Production Reporting Technical Scenario
        3. Reporting Services Ad Hoc Reporting Technical Scenario
      4. Building Dynamics AX Reporting Services Reports Using Visual Studio
        1. Dynamics AX Reporting Development Tools
        2. Integration with Dynamics AX
        3. Report Development Life Cycle
        4. Reporting Tools Model Elements
          1. Reports
          2. Report Designs
            1. Auto design layout
            2. Precision design layout
          3. Structure of a Dynamics AX Reporting Project
          4. Report Data Sources
          5. Data Methods
      5. Ad Hoc Reporting
        1. Deployment: Perspectives and SMDL Models
        2. Performance and Platform Considerations
        3. Security
        4. Creating Ad Hoc Reports
        5. Troubleshooting
          1. Unable to Validate the Report Server
          2. Unable to Generate a Report
          3. SMDL Model Is Not Seen on the Report Server After Successful Model Generation
          4. Unable to Generate an SMDL Model Because One or More Languages Are Missing Some Information
    8. 12. Performance
      1. Introduction
      2. Client/Server Performance
        1. Reducing Round-Trips Between the Client and the Server
          1. CacheAddMethod
          2. RunBase Technique
          3. Caching and Indexing
        2. Writing Tier-Aware Code
          1. Working with Temp Tables
          2. Removing Client Callbacks
          3. Chunking Calls
      3. Transaction Performance
        1. Set-Based Data Manipulation Operators
          1. The insert_recordset Operator
          2. The update_recordset Operator
          3. The delete_from Operator
          4. The RecordInsertList and RecordSortedList Classes
        2. Restartable Jobs and Optimistic Concurrency
        3. Caching
          1. Record Caches
          2. The EntireTable Cache
          3. The RecordViewCache Class
        4. Limiting Field Lists
        5. Field Justification
        6. Other Performance Considerations
      4. Dynamics AX Monitoring Tools
        1. Dynamics AX Trace Parser
        2. Setting Tracing Options
          1. Setting Tracing Options on the AOS
          2. Setting Tracing Options on the Client
        3. Tracing Options and Other Tracing Activities
          1. Troubleshooting Tracing
          2. Importing Traces
          3. Analyzing Traces
        4. Monitoring Client/Server Calls
        5. Monitoring Database Activity
        6. Code Profiler Tool
    9. 13. Configuration and Security
      1. Introduction
      2. IntelliMorph
        1. Best Practices
          1. Principles for Forms
          2. Principles for Reports
        2. Working with IntelliMorph
      3. Licensing and Configuration
        1. Configuration Hierarchy
        2. Configuration Keys
        3. Using Configuration Keys
      4. Security Framework
        1. Organizing Security
        2. Applying Security
          1. Domains
          2. User Group Permissions
          3. Record Level Security
        3. Security Coding
          1. Table Permissions
          2. Code Access Security
          3. Batch Jobs
          4. Best Practice Rules
  7. III. Under the Hood
    1. 14. The Database Layer
      1. Introduction
      2. Transaction Semantics
        1. Transaction Statements
        2. Isolation Levels
          1. Autocommit
          2. Transaction IDs
          3. AOS Process Pool
        3. Concurrency Models
          1. Concurrent Scenarios
          2. Disconnected Updates of the Same Record
          3. Using Relative Updates to Prevent Update Conflicts
          4. Choosing a Concurrency Model During Development
          5. Setting a Concurrency Model Globally
          6. Optimistic Concurrency and Exception Handling
          7. Concurrency Models in Forms
          8. Repeatable Read
      3. Record Identifiers
        1. Allocation
        2. Programming Model
        3. Administration
        4. Upgrade
      4. Company Accounts
        1. Identification
        2. Changing the Company Account
        3. External Accessibility
      5. Unicode Support
        1. Databases
        2. Application Runtime
        3. MorphX Development Environment
        4. Files
        5. DLLs and COM Components
      6. Database Access
        1. Database Synchronization
        2. Table, Column, and Index Naming
        3. Left and Right Justification
        4. Placeholders and Literals
        5. Dynamics AX Type System vs. Database Type System
        6. Database Log and Alerts
      7. Database-Triggering Methods
        1. insert, update, and delete Methods
        2. Selecting Rows
        3. Validating Rows
        4. Changing the Default Behavior
          1. SelectForUpdate
          2. concurrencyModel
          3. selectWithRepeatableRead
          4. readPast
          5. skipTTSCheck
          6. selectLocked
        5. Set-Based DML Statements
      8. Temporary Tables
        1. Using Temporary Tables
        2. Design-Time Setting
        3. Configuration-Time Setting
        4. Application Runtime Setting
      9. Composite Queries
      10. Paging Framework for Queries
        1. Position-Based Paging
        2. Value-Based Paging
      11. Query Framework Enhancement
        1. Complex Queries
        2. Union Queries
          1. UnionBranchID Field
          2. forupdate Flag
        3. Query as a Central Data Modeling Tool
        4. Specifying Query Ranges Using the SysQueryRangeUtil Class
    2. 15. Reflection
      1. Introduction
      2. Reflection System Functions
        1. Intrinsic Functions
        2. TypeOf System Function
        3. ClassIdGet System Function
      3. Reflection APIs
        1. Table Data API
        2. Dictionary API
        3. Treenodes API
    3. 16. The Batch Framework
      1. Introduction
      2. Batch Processing in Dynamics AX
        1. Dynamics AX Batch Concepts
        2. Batch Framework Capabilities
        3. Performance
      3. Common Uses of Batch Processing
      4. Batch-Enabling a Class
      5. Creating a Batch Job
        1. From the Dialog Box of a Class
        2. From the Batch Job Form
          1. Create a Batch Job
          2. Add a Task to a Batch Job
            1. Class parameters
            2. Define dependencies between tasks
        3. Using the Batch API
          1. Create a Batch Job
          2. Add a Task to the Batch Job
          3. Define Dependencies Between Tasks
          4. Save a Batch Job
          5. Example of a Batch Job
      6. Managing the Batch Server Execution Process
        1. Set Up Server Configuration
        2. Create a Batch Group
        3. Manage Batch Jobs
          1. Batch Job Status
          2. Control Maximum Retries
          3. Cancel a Batch Job
          4. Review the Batch Job History
        4. Debug a Batch Task
          1. Configure the AOS for Batch Debugging
          2. Configure the Client for Batch Debugging
          3. Run AxDebug.exe on the Client Computer
    4. 17. The Application Integration Framework
      1. Introduction
      2. Overview of the Application Integration Framework
        1. Overview Scenarios
      3. Overview of Dynamics AX Services
      4. Components of Dynamics AX Services
        1. Overview of Document Services
          1. Document Services Artifacts
          2. Axd<Document> Classes
          3. Ax<Table> Classes
          4. Document Services Use Cases
          5. Document Service Development Tools
        2. Overview of Custom Services
          1. Custom Service Use Cases
          2. Custom Services Development
      5. Working with Custom Services
        1. Creating a Service Implementation Class
        2. Creating a Service Contract
        3. Implementing Data Objects
        4. Discovering Custom Services
      6. Working with Document Services
        1. Creating Dynamics AX Queries
        2. Generating Document Services
        3. Customizing Document Services
          1. Customizing Tables
          2. Adding Custom Service Operations
          3. Customizing Validation Logic
          4. Customizing Defaulting Logic
          5. Customizing Axd<Document> Queries
          6. Customizing Security
        4. Publishing Dynamics AX Services
        5. Configuring Dynamics AX Services
          1. Configuring WCF Parameters
          2. Configuring AIF Parameters
          3. Configuring Access to Services
          4. Troubleshooting Tips for Services
        6. Consuming Dynamics AX Services
          1. Sample WCF Client for Dynamics AX Services
          2. Updating Business Documents
            1. Full updates
            2. Partial updates
            3. Document hashes
          3. Overriding Default Values in SOAP Headers
            1. Message identifier
            2. Destination endpoint (target company)
            3. Source endpoint and source endpoint user
            4. Sample SOAP message
      7. Sending One-Way Requests from Dynamics AX
        1. Implementing a Trigger for Transmission
          1. AIF Send API
          2. AxdSend API
        2. Configuring Transmission Mechanisms
      8. Consuming Web Services from Dynamics AX
        1. Dynamics AX Service References
        2. Consuming an External Web Service
          1. Getting the WSDL and Creating a Service Reference
          2. Writing Integration Code
          3. Configuring Service References
        3. Guidelines for Consuming External Web Services
          1. Integration Guidelines
          2. Security Guidelines
            1. Privacy
            2. Authentication
            3. Authorization
          3. Custom SOAP Headers
      9. Performance Considerations
    5. 18. Code Upgrade
      1. Introduction
      2. Terminology
      3. Why Code Upgrade Is Necessary
        1. Role of Customization
        2. Role of Layers
        3. Overlayering and Conflicts
      4. Starting a Code Upgrade
        1. Conflict Types
        2. Conflict Detection Tool
          1. Conflict Detection Algorithm
      5. Upgrade Projects
        1. Conflicts in Layered Upgrade Projects
          1. Contents Conflicts
            1. Property conflicts
            2. Resolution Tip
              1. Code conflict
            3. Resolution Tip
              1. Ordering conflict
          2. Overlayering Conflicts
            1. Resolution Tip
          3. Delete Conflicts
            1. Resolution Tip
        2. Conflicts in Framework Conflict Projects
          1. Trustworthy Computing Conflicts
            1. Record level security
            2. Resolution Tip
              1. Parameter validation
            3. Resolution Tip
              1. Use of dangerous API
            4. Resolution Tip
              1. Reference to unsigned .NET assembly
            5. Resolution Tip
              1. Validation of display or edit values
            6. Resolution Tip
          2. Record ID and Table ID Reference Conflicts
            1. RecId relation missing
            2. Resolution Tip
              1. TableId relation missing
            3. Resolution Tip
              1. Field uses RecId
            4. Resolution Tip
              1. Field uses TableId
            5. Resolution Tip
              1. Type extends RecId
            6. Resolution Tip
              1. Type extends TableId
            7. Resolution Tip
        3. Upgrade Project Tools
          1. Visual Indicators
            1. Mark As Resolved, Unresolved
            2. Remove Resolved Elements
            3. Rerun Conflict Detection
      6. Code Upgrade Tools
        1. Element Usage Log Report
        2. Upgrade Estimate Report
        3. Compare Tool
        4. Property Sheet
        5. X++ Code Editor
      7. Finishing a Code Upgrade
      8. Smart Customizations
        1. Using IntelliMorph Technology
        2. Creating New Elements or Using Class Substitution
        3. Modifying Stable Application Elements
  8. IV. Appendices
    1. A. Application Files
      1. Application File Extensions
    2. B. SQL Server 2005, SQL Server 2008, and Oracle Database 10g Comparison
    3. C. Source Code Changes Required for Upgrade
      1. Code Changes
      2. Metadata Changes
      3. Table Modifications
      4. Multiple Time Zones
        1. Language Enhancements
        2. API Enhancements
        3. Metadata Enhancements
        4. System Field Changes
          1. Upgraded System Fields
        5. DateTime Control and Form Changes
  9. D. Glossary
  10. E. About the Authors
    1. Principal Authors
    2. Contributing Authors
  11. Index
  12. About the Authors
  13. Copyright