Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Inside AX 2012 R3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 86

Inside Microsoft

Dynamics AX 2012 R3
The Microsoft Dynamics AX Team
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright 2014 by Microsoft Corporation
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any
means without the written permission of the publisher.
Library of Congress Control Number: 2014940599
ISBN: 978-0-7356-8510-9
Printed and bound in the United States of America.
First Printing
Microsoft Press books are available through booksellers and distributors worldwide. If you need support related
to this book, email Microsoft Press Book Support at mspinput@microsoft.com. Please tell us what you think of
this book at http://aka.ms/tellpress.
Microsoft and the trademarks listed at http://www.microsoft.com/en-us/legal/intellectualproperty/Trademarks/
EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective
owners.
The example companies, organizations, products, domain names, email addresses, logos, people, places, and
events depicted herein are fctitious. No association with any real company, organization, product, domain name,
email address, logo, person, place, or event is intended or should be inferred.
This book expresses the authors views and opinions. The information contained in this book is provided without
any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or
distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by
this book.
Acquisitions Editor: Rosemary Caperton
Developmental Editor: Carol Dillingham
Editorial Production: Online Training Solutions, Inc. (OTSI)
Copyeditors: Kathy Krause and Victoria Thulman (OTSI)
Indexer: Susie Carr (OTSI)
Cover: Twist Creative Seattle and Joel Panchot
iii
Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
PART I A TOUR OF THE DEVELOPMENT ENVIRONMENT
Chapter 1 Architectural overview 3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
AX 2012 fve-layer solution architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
AX 2012 application platform architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Application development environments . . . . . . . . . . . . . . . . . . . . . . . . . 6
Data tier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Middle tier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Presentation tier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
AX 2012 application meta-model architecture . . . . . . . . . . . . . . . . . . . . . . . . . 9
Application data element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
MorphX user interface control element types . . . . . . . . . . . . . . . . . . . . 11
Workfow element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Code element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Services element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Role-based security element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Web client element types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Documentation and resource element types . . . . . . . . . . . . . . . . . . . . 16
License and confguration element types . . . . . . . . . . . . . . . . . . . . . . . . 17
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our
books and learning resources for you. To participate in a brief online survey, please visit:
microsoft.com/learning/booksurvey
iv Contents
Chapter 2 The MorphX development environment and tools 19
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Application Object Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Navigating through the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Creating elements in the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Modifying elements in the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Refreshing elements in the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Element actions in the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Element layers and models in the AOT . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Creating a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Automatically generating a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Project types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
The property sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
X++ code editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Shortcut keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Editor scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Label editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Creating a label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Referencing labels from X++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Best Practices tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Suppressing errors and warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Adding custom rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Enabling debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Debugger user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Debugger shortcut keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Reverse Engineering tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
UML data model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
UML object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Entity relationship data model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Contents v
Table Browser tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Find tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Compare tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Starting the Compare tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Using the Compare tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Compare APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Cross-Reference tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Version control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Element life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Common version control tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Working with labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Synchronizing elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Viewing the synchronization log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Showing the history of an element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Comparing revisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Viewing pending elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Creating a build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Integrating AX 2012 with other version control systems . . . . . . . . . . 74
Chapter 3 AX 2012 and .NET 75
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Integrating AX 2012 with other systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Using third-party assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Writing managed code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Hot swapping assemblies on the server . . . . . . . . . . . . . . . . . . . . . . . . . 87
Using LINQ with AX 2012 R3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
The var keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Extension methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Anonymous types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Lambda expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Walkthrough: Constructing a LINQ query . . . . . . . . . . . . . . . . . . . . . . . 91
Using queries to read data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
AX 2012 R3specifc extension methods . . . . . . . . . . . . . . . . . . . . . . . . 98
Updating, deleting, and inserting records . . . . . . . . . . . . . . . . . . . . . . . 99
vi Contents
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Advanced: limiting overhead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Chapter 4 The X++ programming language 105
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
The type system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Value types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Reference types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Type hierarchies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Variable declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
XML documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Classes and interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Pre-event and post-event handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Code access security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Compiling and running X++ as .NET CIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Design and implementation patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Class-level patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Table-level patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Contents vii
PART II DEVELOPING FOR AX 2012
Chapter 5 Designing the user experience 151
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Role-tailored design approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
User experience components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Navigation layer forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Work layer forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Role Center pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Cues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Designing Role Centers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Area pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Designing area pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
List pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Scenario: taking a call from a customer . . . . . . . . . . . . . . . . . . . . . . . . 161
Using list pages as an alternative to reports . . . . . . . . . . . . . . . . . . . . 162
Designing list pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Details forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Transaction details forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Enterprise Portal web client user experience . . . . . . . . . . . . . . . . . . . . . . . . . 169
Navigation layer forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Work layer forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Designing for Enterprise Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Designing for your users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Chapter 6 The AX 2012 client 173
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Working with forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Form patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Form metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Form data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Form queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
viii Contents
Adding controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Control overrides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Control data binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Design node properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Run-time modifcations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Action controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Layout controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Input controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
ManagedHost control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Other controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Using parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Types of parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Referencing a part from a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Adding navigation items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
MenuItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Menu defnitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Customizing forms with code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Method overrides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Auto variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Business logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Custom lookups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Integrating with the Microsoft Offce client . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Make data sources available to Offce Add-ins . . . . . . . . . . . . . . . . . 202
Build an Excel template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Build a Word template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Add templates for users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Chapter 7 Enterprise Portal 207
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Enterprise Portal architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Enterprise Portal components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Web parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
AOT elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Contents ix
Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Enterprise Portal framework controls . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Developing for Enterprise Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Creating a model-driven list page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Creating a details page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Session disposal and caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Proxy classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
ViewState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Secure web elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Record context and encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
SharePoint integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Site navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Site defnitions, page templates, and web parts . . . . . . . . . . . . . . . . . 249
Importing and deploying a web part page . . . . . . . . . . . . . . . . . . . . . 252
Enterprise Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Chapter 8 Workfow in AX 2012 257
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
AX 2012 workfow infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Windows Workfow Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Key workfow concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Workfow document and workfow document class . . . . . . . . . . . . . 262
Workfow categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Workfow types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
x Contents
Event handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Workfow elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Workfows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Workfow instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Work items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Workfow architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Workfow runtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Workfow runtime interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Logical approval and task workfows. . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Workfow life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Implementing workfows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Creating workfow artifacts, dependent artifacts,
and business logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Managing state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Creating a workfow category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Creating the workfow document class . . . . . . . . . . . . . . . . . . . . . . . . . 280
Adding a workfow display menu item . . . . . . . . . . . . . . . . . . . . . . . . . 283
Activating the workfow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Chapter 9 Reporting in AX 2012 289
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Inside the AX 2012 reporting framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Client-side reporting solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Server-side reporting solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Report execution sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Planning your reporting solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Reporting and users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Roles in report development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Creating production reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Model elements for reports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
SSRS extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Contents xi
AX 2012 extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Creating charts for Enterprise Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
AX 2012 chart development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Integration with AX 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Data series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Adding interactive functions to a chart . . . . . . . . . . . . . . . . . . . . . . . . 308
Overriding the default chart format . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Troubleshooting the reporting framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
The report server cannot be validated . . . . . . . . . . . . . . . . . . . . . . . . . 311
A report cannot be generated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
A chart cannot be debugged because of SharePoint
sandbox issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
A report times out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Chapter 10 BI and analytics 313
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Components of the AX 2012 BI solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Implementing the AX 2012 BI solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Implementing the prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Confguring an SSAS server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Deploying cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Deploying cubes in an environment with multiple partitions . . . . . 321
Processing cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Provisioning users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Customizing the AX 2012 BI solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Confguring analytic content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Customizing cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Extending cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Integrating AX 2012 analytic components with external
data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Maintaining customized and extended projects in the AOT . . . . . . 340
Creating cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Identifying requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Defning metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
xii Contents
Generating and deploying the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Adding KPIs and calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Displaying analytic content in Role Centers . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Providing insights tailored to a persona . . . . . . . . . . . . . . . . . . . . . . . . 352
Choosing a presentation tool based on a persona . . . . . . . . . . . . . . . 352
SQL Server Power View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Power BI for Offce 365 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Comparing Power View and Power BI . . . . . . . . . . . . . . . . . . . . . . . . . 360
Authoring with Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Business Overview web part and KPI List web part . . . . . . . . . . . . . . 361
Developing reports with Report Builder . . . . . . . . . . . . . . . . . . . . . . . 366
Developing reports with the Visual Studio tools for AX 2012 . . . . . 366
Chapter 11 Security, licensing, and confguration 371
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Security framework overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Data security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Developing security artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Setting permissions for a form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Setting permissions for server methods . . . . . . . . . . . . . . . . . . . . . . . . 379
Setting permissions for controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Creating privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Assigning privileges and duties to security roles . . . . . . . . . . . . . . . . 381
Using valid time state tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Validating security artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Creating users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Assigning users to roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Setting up segregation of duties rules . . . . . . . . . . . . . . . . . . . . . . . . . 385
Creating extensible data security policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Data security policy concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Developing an extensible data security policy . . . . . . . . . . . . . . . . . . 386
Debugging extensible data security policies . . . . . . . . . . . . . . . . . . . . 389
Contents xiii
Security coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Table permissions framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Code access security framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Best practice rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Security debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Licensing and confguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Confguration hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Confguration keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Using confguration keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Types of CALs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Customization and licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Chapter 12 AX 2012 services and integration 405
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Types of AX 2012 services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
System services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Custom services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Document services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Security considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Publishing AX 2012 services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Consuming AX 2012 services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Sample WCF client for CustCustomerService . . . . . . . . . . . . . . . . . . . . 422
Consuming system services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Updating business documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Invoking custom services asynchronously . . . . . . . . . . . . . . . . . . . . . . 430
The AX 2012 send framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Implementing a trigger for transmission . . . . . . . . . . . . . . . . . . . . . . . 432
Consuming external web services from AX 2012 . . . . . . . . . . . . . . . . . . . . . . 435
Performance considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Chapter 13 Performance 437
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Client/server performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Reducing round trips between the client and the server . . . . . . . . . 438
xiv Contents
Writing tier-aware code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Transaction performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Set-based data manipulation operators . . . . . . . . . . . . . . . . . . . . . . . . 447
Restartable jobs and optimistic concurrency . . . . . . . . . . . . . . . . . . . . 465
Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Field lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Field justifcation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Performance confguration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
SQL Administration form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Server Confguration form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
AOS confguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Client confguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Client performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Number sequence caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Extensive logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Master scheduling and inventory closing . . . . . . . . . . . . . . . . . . . . . . . 487
Coding patterns for performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Executing X++ code as common intermediate language . . . . . . . . . 487
Using parallel execution effectively . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
The SysOperation framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Patterns for checking to see whether a record exists. . . . . . . . . . . . . 494
Running a query only as often as necessary . . . . . . . . . . . . . . . . . . . . 495
When to prefer two queries over a join . . . . . . . . . . . . . . . . . . . . . . . . 496
Indexing tips and tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
When to use frstfast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Optimizing list pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Aggregating felds to reduce loop iterations . . . . . . . . . . . . . . . . . . . . 499
Performance monitoring tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Microsoft Dynamics AX Trace Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Monitoring database activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Using the SQL Server connection context to fnd the SPID
or user behind a client session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
The client access log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Visual Studio Profler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Contents xv
Chapter 14 Extending AX 2012 515
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
The SysOperation framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
SysOperation framework classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
SysOperation framework attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Comparing the SysOperation and RunBase frameworks . . . . . . . . . . . . . . . 517
RunBase example: SysOpSampleBasicRunbaseBatch . . . . . . . . . . . . . 518
SysOperation example: SysOpSampleBasicController . . . . . . . . . . . . 526
The RunBase framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Inheritance in the RunBase framework . . . . . . . . . . . . . . . . . . . . . . . . . 533
Property method pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
Pack-unpack pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Client/server considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
The extension framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Create an extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Add metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Extension example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Eventing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Pre and post events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Event handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Eventing example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Chapter 15 Testing 549
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Unit testing features in AX 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
Using predefned test attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
Creating test attributes and flters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Microsoft Visual Studio 2010 test tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
Using all aspects of the ALM solution . . . . . . . . . . . . . . . . . . . . . . . . . . 556
Using an acceptance test driven development approach . . . . . . . . . 557
Using shared steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Recording shared steps for fast forwarding . . . . . . . . . . . . . . . . . . . . . 560
xvi Contents
Developing test cases in an evolutionary manner . . . . . . . . . . . . . . . 562
Using ordered test suites for long scenarios . . . . . . . . . . . . . . . . . . . . 562
Putting everything together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Executing tests as part of the build process . . . . . . . . . . . . . . . . . . . . . 563
Using the right tests for the job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Chapter 16 Customizing and adding Help 569
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Help system overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
AX 2012 client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Help viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Help server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
AOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Help content overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Publisher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Table of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Summary page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Creating content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
Walkthrough: create a topic in HTML . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Adding labels, felds, and menu items to a topic . . . . . . . . . . . . . . . . 584
Make a topic context-sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
Update content from other publishers . . . . . . . . . . . . . . . . . . . . . . . . . 587
Create a table of contents fle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Creating non-HTML content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Publishing content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Add a publisher to the Web.confg fle . . . . . . . . . . . . . . . . . . . . . . . . . 594
Publish content to the Help server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Set Help document set properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
Troubleshooting the Help system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
The Help viewer cannot display content . . . . . . . . . . . . . . . . . . . . . . . . 598
The Help viewer cannot display the table of contents . . . . . . . . . . . . 599
Contents xvii
PART III UNDER THE HOOD
Chapter 17 The database layer 603
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
Temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
InMemory temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
TempDB temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Creating temporary tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Surrogate keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
Alternate keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Table relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
EDT relations and table relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Foreign key relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
The CreateNavigationPropertyMethods property . . . . . . . . . . . . . . . 618
Table inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Modeling table inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Table inheritance storage model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
Polymorphic behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Performance considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
Unit of Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Date-effective framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Relational modeling of date-effective entities . . . . . . . . . . . . . . . . . . 628
Support for data retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Run-time support for data consistency . . . . . . . . . . . . . . . . . . . . . . . . . 631
Full-text support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
The QueryFilter API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Data partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Partition management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Development experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
Run-time experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
xviii Contents
Chapter 18 Automating tasks and document distribution 641
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Batch processing in AX 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Common uses of the batch framework . . . . . . . . . . . . . . . . . . . . . . . . . 643
Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Creating and executing a batch job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Creating a batch-executable class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Creating a batch job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Confguring the batch server and creating a batch group . . . . . . . . 654
Managing batch jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Debugging a batch task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Print management in AX 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Common uses of print management . . . . . . . . . . . . . . . . . . . . . . . . . . 662
The print management hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
Print management settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
Chapter 19 Application domain frameworks 671
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
The organization model framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
How the organization model framework works . . . . . . . . . . . . . . . . . 672
When to use the organization model framework . . . . . . . . . . . . . . . . 675
Extending the organization model framework . . . . . . . . . . . . . . . . . . 677
The product model framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
How the product model framework works . . . . . . . . . . . . . . . . . . . . . 681
When to use the product model framework . . . . . . . . . . . . . . . . . . . . 685
Extending the product model framework . . . . . . . . . . . . . . . . . . . . . . 685
The operations resource framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
How the operations resource framework works . . . . . . . . . . . . . . . . 687
When to use the operations resource framework . . . . . . . . . . . . . . . 690
Extending the operations resource framework . . . . . . . . . . . . . . . . . . 690
MorphX model element prefxes for the operations resource
framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
The dimension framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
How the dimension framework works . . . . . . . . . . . . . . . . . . . . . . . . . 692
Contents xix
Constraining combinations of values. . . . . . . . . . . . . . . . . . . . . . . . . . . 694
Creating values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Extending the dimension framework . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Querying data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
Physical table references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
The accounting framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
How the accounting framework works . . . . . . . . . . . . . . . . . . . . . . . . . 698
When to use the accounting framework . . . . . . . . . . . . . . . . . . . . . . . 700
Extensions to the accounting framework . . . . . . . . . . . . . . . . . . . . . . . 700
Accounting framework process states . . . . . . . . . . . . . . . . . . . . . . . . . 700
MorphX model element prefxes for the accounting framework . . 701
The source document framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
How the source document framework works . . . . . . . . . . . . . . . . . . . 702
When to use the source document framework . . . . . . . . . . . . . . . . . . 703
Extensions to the source document framework . . . . . . . . . . . . . . . . . 703
MorphX model element prefxes for the source document
framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
Chapter 20 Refection 707
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
Refection system functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
Intrinsic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
typeOf system function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
classIdGet system function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Refection APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Table data API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Dictionary API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Treenodes API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
TreeNodeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
Chapter 21 Application models 725
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728
xx Contents
Element IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Creating a model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
Preparing a model for publication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
Setting the model manifest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
Exporting the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Signing the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
Importing model fles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
Upgrading a model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
Moving a model from test to production . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
Creating a test environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
Preparing the test environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
Deploying the model to production . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
Element ID considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
Model store API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
PART IV BEYOND AX 2012
Chapter 22 Developing mobile apps for AX 2012 745
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
The mobile app landscape and AX 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
Mobile architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
Mobile architecture components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
Message fow and authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
Using AX 2012 services for mobile clients . . . . . . . . . . . . . . . . . . . . . . 750
Developing an on-premises listener . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
Developing a mobile app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
Platform options and considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
Developer documentation and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
Third-party libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
Best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
Key aspects of authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
User experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
Globalization and localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
App monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Contents xxi
Web traffc debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Architectural variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
On-corpnet apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Web apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759
Chapter 23 Managing the application life cycle 761
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
Lifecycle Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762
Deploying customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
Data import and export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769
Test Data Transfer Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769
Data Import/Export Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771
Choosing between the Test Data Transfer Tool and DIXF . . . . . . . . . 772
Benchmarking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Index 775
About the authors 795
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our
books and learning resources for you. To participate in a brief online survey, please visit:
microsoft.com/learning/booksurvey
This page intentionally left blank
xxiii
Foreword
T
he release of Microsoft Dynamics AX 2012 R3 and this book coincide with the tenth
anniversary of my involvement with the development of this product. Ive had the
pleasure to work with a great team of people throughout that period. When I refect
on the modest ambition we set out with a decade ago, Im excited to see all that we
have achieved and am grateful for all the support we received along the way from our
customers, partners, and the community around this product.
We set out to build a next-generation line-of-business system that empowered
people. We wanted to go beyond traditional ERP in multiple ways:
First and foremost was to create a system of empowerment, not a system of
records. Microsoft Dynamics AX is designed to help people do their jobs, not
to record what they did after they did it.
Second, we wanted to maintain an agile system that allowed businesses to
change at their own pace and not at the pace of previous generations of elec-
tronic concrete.
Third, we wanted to provide functional depth and richness while maintaining
simplicity of implementation, to allow both midsize and large organizations to
use the same system.
The embodiment of our frst goal is role-tailored computing and pervasive BI. Those
new to the Microsoft Dynamics AX community after AX 2009 cant imagine a day when
that wasnt a standard part of the product. AX 2012 takes that richness to a whole
new level with more than 80 predefned security roles, and Role Centers for more
than 40 distinct functions in an organization.
The implementation of our second goal is in the richness of the AX 2012 metadata
system and tools, combined with the fact that all of our solutions and localizations are
designed to work together. AX 2012 enhances those capabilities even further while
adding the organizational model, self-balancing dimensions, date effectivity, and other
powerful application foundation elements.
The realization of the third goal came in the form of deep industry solutions for
manufacturing, distribution, retail, service industries, and the public sector, along with
a comprehensive set of life cycle services for design, development, deployment, and
operations.
xxiv Foreword
This book focuses on the enhancements to the Microsoft Dynamics AX developer
toolset and is written by the team that brought you those tools. Its truly an insiders
view of the entire AX 2012 development and runtime environment (now updated for
the AX 2012 R3 release). I hope you enjoy it as much as we enjoyed writing the book
and creating the product.
Heres to the next ten years of our journey together.
Thanks,
Hal Howard
Head of Product Development, Microsoft Dynamics AX
Corporate Vice President, Microsoft Dynamics Research and Development
xxv
Introduction
M
icrosoft Dynamics AX 2012 represents a new generation of enterprise resource
planning (ERP) software. With more than 1,000 new features and prebuilt indus-
try capabilities for manufacturing, distribution, services, retail, and the public sector,
AX 2012 provides a robust platform for developers to deliver specialized functionality
more effciently to the industries that they support. AX 2012 is a truly global solution,
able to scale with any business as it grows. It is simple enough to deploy for a single
business unit in a single country, yet robust enough to support the unique requirements
for business systems in 36 countries/regionsall from a single-instance deployment of
the software. With AX 2012 R3, Microsoft Dynamics AX delivers new levels of capability
in warehouse and transportation management, demand planning, and retail.
AX 2012 R3 also represents an important step forward in the evolution of Microsoft
Dynamics AX for the cloud. As Microsoft Technical Fellow Mike Ehrenberg explains:
Microsoft is transforming for a cloud-frst, mobile-frst world. As part
of that transformation, with the AX 2012 R3 release, we are certifying
the deployment of Microsoft Dynamics AX on the Microsoft Azure
cloud platform, which uses the Azure Infrastructure as a Service (IaaS)
technology. This opens up the option for customers ready to move to
the cloud to deploy the power of Microsoft Dynamics AX to run their
business; for customers that favor on-premises deployment, it comple-
ments the option to harness the Microsoft Azure cloud platform for
training, development, testing, and disaster recoveryall workloads
with the uneven demand that the cloud serves so well. One of the
most exciting new capabilities introduced with AX 2012 R3 is Lifecycle
Services, our new Azure cloud-based service that streamlines every
aspect of the ERP deployment, management, servicing, and upgrade
lifecycleregardless of whether AX 2012 itself is deployed on-premises
or in the cloud. We are leveraging the cloud to deliver rapidly evolving
services to help all of our customers ensure that they are following
best practices across their AX 2012 projects. We are already seeing
great results in rapid deployments, streamlined support interactions,
and performance tuningand this is only the beginning of our very
exciting journey.
xxvi Introduction
Customers have also weighed in on the benefts of Microsoft Dynamics AX 2012:
Microsoft Dynamics AX 2012 allows us to collaborate within our
organization and with our constituents using built-in controls and
fund/encumbrance accounting capabilities to ensure compliance
with Public Sector requirements and using out-of the-box Business
Analytics and Intelligence so executives can make effective decisions
in real time.
Mike Bailey
Director of Finance and Information Services
City of Redmond (Washington)
With AX 2012, developing for and customizing Microsoft Dynamics AX
will be easier than ever. Developers will be able to work with X++
directly from within Microsoft Visual Studio and enjoy more sophisticated
features in the X++ editor, for example. Also, the release includes more
prebuilt interoperability with Microsoft SharePoint Server and SQL
Server Reporting Services, so that developers spend less time on mun-
dane work when setting up customer systems.
Guido Van de Velde
Director of MECOMS
Ferranti Computer Systems
AX 2012 is substantially different from its predecessor, which can mean a steep
learning curve for developers and system implementers who have worked with previ-
ous versions. However, by providing a broad overview of the architectural changes, new
technologies, and tools for this release, the authors of Inside Microsoft Dynamics AX 2012
R3 have created a resource that will help reduce the time that it takes for developers to
become productive.
The history of Microsoft Dynamics AX
Historically, Microsoft Dynamics AX encompasses more than 25 years of experience
in business application innovation and developer productivity. Microsoft acquired
the predecessor of Microsoft Dynamics AX, called Axapta, in 2002, with its purchase
of the Danish company Navision A/S. The success of the product has spurred an
increasing commitment of research and development resources, which allows
Microsoft Dynamics AX to grow and strengthen its offering continuously.
Introduction xxvii
The development team that created AX 2012 consists of three large teams, two that
are based in the United States (Fargo, North Dakota, and Redmond, Washington) and one
that is based in Denmark (Copenhagen). The Fargo team focuses on fnance and human
resources (HR), the Redmond team concentrates on project management and account-
ing and customer relationship management (CRM), and the Copenhagen team delivers
supply chain management (SCM). In addition, a framework team develops infrastructure
components, and a worldwide distributed team localizes the Microsoft Dynamics AX
features to meet national regulations or local differences in business practices in numer-
ous languages and markets around the world.
To clarify a few aspects of the origins of Microsoft Dynamics AX, the authors contacted
people who participated in the early stages of the Microsoft Dynamics AX development
cycle. The frst question we asked was, How was the idea of using X++ as the program-
ming language for Microsoft Dynamics AX conceived?
We had been working with an upgraded version of XAL for a while
called OO XAL back in 1996/1997. At some point in time, we stopped
and reviewed our approach and looked at other new languages like
Java. After working one long night, I decided that our approach had
to change to align with the latest trends in programming languages,
and we started with X++.
Erik Damgaard
Cofounder of Damgaard Data
Of course, the developers had several perspectives on this breakthrough event.
One morning when we came to work, nothing was working. Later in the
morning, we realized that we had changed programming languages!
But we did not have any tools, so for months we were programming
in Notepad without compiler or editor support.
Anonymous developer
Many hypotheses exist regarding the origin of the original product name, Axapta.
Axapta was a constructed name, and the only requirement was that the letter X be in-
cluded, to mark the association with its predecessor, XAL. The X association carries over
in the name Microsoft Dynamics AX.
xxviii Introduction
Who should read this book
This book explores the technology and development tools in AX 2012 through the
AX 2012 R3 release. It is designed to help new and existing Microsoft Dynamics AX
developers by providing holistic and in-depth information about developing for
AX 2012information that may not be available from other resources, such as SDK
documentation, blogs, or forums. It aids developers who are either customizing
AX 2012 for a specifc implementation or building modules or applications that blend
seamlessly with AX 2012. System implementers and consultants will also fnd much of
the information useful.
Assumptions
To get full value from this book, you should have knowledge of common object-oriented
concepts from languages such as C++, C#, and Java. You should also have knowledge
of relational database concepts. Knowledge of Structured Query Language (SQL) and
Microsoft .NET technology is also advantageous. Transact-SQL statements are used to
perform relational database tasks, such as data updates and data retrieval.
Who should not read this book
This book is not aimed at those who install, upgrade, or deploy AX 2012. It is also be-
yond the scope of this book to include details about the sizing of production environ-
ments. For more information about these topics, refer to the extensive installation and
implementation documentation that is supplied with the product or that is available on
Microsoft TechNet, Microsoft Developer Network (MSDN), and other websites.
The book also does not provide instructions for those who confgure parameter
options within AX 2012 or the business users who use the application in their day-to-
day work. For assistance with these activities, refer to the help that is included with
the product and available on TechNet at http://technet.microsoft.com/en-us/library
/gg852966.aspx.
Introduction xxix
Organization of this book
Although Inside Microsoft Dynamics AX 2012 R3 does not provide exhaustive coverage
of every feature in the product, it does offer a broad view that will beneft developers
as they develop for AX 2012.
This book is divided into four sections, each of which focuses on AX 2012 from a dif-
ferent angle. Part I, A tour of the development environment, provides an overview of
the AX 2012 architecture that has been written with developers in mind. The chapters
in Part I also provide a tour of the internal AX 2012 development environment to help
new developers familiarize themselves with the designers and tools that they will use
to implement their customizations, extensions, and integrations.
Part II, Developing for AX 2012, provides the information that developers need to
customize and extend AX 2012. In addition to explanations of the features, many chap-
ters include examples, some of which are available as downloadable fles that can help
you learn how to code for AX 2012. For information about how to access these fles, see
the Code samples section, later in this introduction.
Part III, Under the hood, is largely devoted to illustrating how developers can use
the underlying foundation of the AX 2012 application frameworks to develop their
solutions, with a focus on the database layer, system and application frameworks, re-
fection, and models.
Part IV, Beyond AX 2012, focuses on developing companion apps for mobile devices
that allow AX 2012 users to participate in critical business processes even when they
are away from their computers. It also describes exciting new techniques and tools, such
as Lifecycle Services, that help partners and customers manage every aspect of the
application life cycle.
xxx Introduction
Conventions and features in this book
This book presents information by using the following conventions, which are designed
to make the information readable and easy to follow.
Application Object Tree (AOT) paths use backslashes to separate nodes, such as
Forms\AccountingDistribution\Methods.
The names of methods, functions, properties and property values, felds, and
nodes appear in italics.
Registry keys and T-SQL commands appear in capital letters.
User interface (UI) paths use angle brackets to indicate actionsfor example,
On the File menu, point to Tools > Options.
Boxed elements with labels such as Note provide additional information or
alternative methods for completing a step successfully.
Text that you type (apart from code blocks) appears in bold.
A plus sign (+) between two key names means that you must press those keys at
the same time. For example, Press Alt+Tab means that you hold down the Alt
key while you press the Tab key.
System requirements
To work with most of the sample code, you must have the RTM version of AX 2012 in-
stalled. For the Language-Integrated Query (LINQ) samples, you must be using AX 2012
R3. For information about the system requirements for installing Microsoft Dynamics
AX 2012, see the Microsoft Dynamics AX 2012 Installation Guide at
http://www.microsoft.com/en-us/download/details.aspx?id=12687
You must also have an Internet connection to download the sample fles that are
provided as supplements to many of the chapters.
Note Some of the features described in this book, such as data partitioning
and the EP Chart Control, apply only to AX 2012 R2 and AX 2012 R3. That is
noted where those features are discussed.
Introduction xxxi
Code samples
Most of the chapters in this book include code examples that let you interactively try
out the new material presented in the main text. You can download the example code
from the following page:
http://aka.ms/InsideDynaAXR3
Follow the instructions to download the 9780735685109_fles.zip fle.
Installing the code samples
Follow these steps to install the code samples on your computer:
1. Unzip the fle that you downloaded from the books website.
2. If prompted, review the displayed end user license agreement. If you accept the
terms, select the accept option, and then click Next.
Note If the license agreement doesnt appear, you can access it
from the same webpage from which you downloaded the fle.
Using the code samples
The code examples referenced in each chapter are provided as both .xpo fles that you
can import into Microsoft Dynamics AX and Visual Studio projects that you can open
through the corresponding .csproj fles. Many of these examples are incomplete, and
you cannot import and run them successfully without following the steps indicated in
the associated chapter.
xxxii Introduction
Acknowledgments
We want to thank all the people who assisted us in bringing this book to press. We
apologize for anyone whose name we missed.
Microsoft Dynamics product team
Special thanks go to the following colleagues, whom were fortunate to work with.
Margaret Sherman, whose Managing Editor duties included wrangling authors,
chasing down stray chapters, translating techno-speak into clear English, keeping
numerous balls in the air, and herding a few cats. Margaret kept the project moving
forward, on schedule, on budget, and with a real commitment to quality content.
Thank you, Margaret! This project wouldnt have happened without your leadership!
Mark Baker and Steve Kubis, who contributed ace project management and editing
work.
Margo Crandall, who provided a quick and accurate technical review at the last min-
ute for Chapter 23.
Hal Howard, Richard Barnwell, and Ann Beebe, who sponsored the project and pro-
vided resources for it.
Were also grateful to the following members of the product team, who provided us
with the reviews and research that helped us refne this book:
Ned Baker
Ian Beck
Andy Blehm
Jim Brotherton
Ed Budrys
Gregory Christiaens
Ahmad El Husseini
Josh Honeyman
Hitesh Jawa
Vijeta Johri
Bo Kampmann
Vinod Kumar
Arif Kureshy
Josh Lange
Mey Meenakshisundaram
Igor Menshutkin
Jatan Modi
Sasha Nazarov
Adrian Orth
Christopher Read (Entirenet)
Bruce Rivard
Gana Sadasivam
Alex Samoylenko
Ramesh Shankar
Tao Wang
Lance Wheelwright
Chunke Yang
Introduction xxxiii
In addition, we want to thank Joris de Gruyter of Streamline Systems LLC. His
SysTestListenerTRX code samples on CodePlex (http://dynamicsaxbuild.codeplex.com
/releases), with supporting documentation on his blog (http://daxmusings.blogspot.com/),
and his collaboration as we investigated this approach for executing SysTests from
Microsoft Dynamics AX were valuable resources as we prepared the chapter on testing.
Microsoft Press
Another big thank you goes to the great people at Microsoft Press for their support
and expertise throughout the writing and publishing process.
Carol Dillingham, the Content Project Manager for the book, who provided ongoing
support and guidance throughout the life of the project.
Rosemary CapertonAcquisitions Editor
Allan IversenTechnical Reviewer
Kathy KrauseProject Editor and Copyeditor with Online Training Solutions, Inc.
(OTSI)
Errata, updates, & book support
Weve made every effort to ensure the accuracy of this book. If you discover an error,
please submit it to us via mspinput@microsoft.com. You can also reach the Microsoft
Press Book Support team for other support via the same alias. Please note that product
support for Microsoft software and hardware is not offered through this address. For help
with Microsoft software or hardware, go to http://support.microsoft.com.
Free ebooks from Microsoft Press
From technical overviews to in-depth information on special topics, the free ebooks
from Microsoft Press cover a wide range of topics. These ebooks are available in PDF,
EPUB, and Mobi for Kindle formats, ready for you to download at:
http://aka.ms/mspressfree
Check back often to see what is new!
xxxiv Introduction
This edition of the book is dedicated to Hal Howard,
with many thanks for your leadership.
THE MICROSOFT DYNAMICS AX TEAM
We want to hear from you
At Microsoft Press, your satisfaction is our top priority, and your feedback our most
valuable asset. Please tell us what you think of this book at:
http://aka.ms/tellpress
We know you're busy, so we've kept it short with just a few questions. Your answers
go directly to the editors at Microsoft Press. (No personal information will be requested.)
Thanks in advance for your input!
Stay in touch
Lets keep the conversation going! Were on Twitter:
http://twitter.com/MicrosoftPress
75
C HAP T E R 3
AX 2012 and .NET
In this chapter
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Integrating AX 2012 with other systems. . . . . . . . . . . . . . . . . . . . . 76
Using LINQ with AX 2012 R3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Introduction
Complex systems, such as AX 2012, are often deployed in heterogeneous environments that contain
several disparate systems. Often, these systems contain legacy data that might be required for running
AX 2012, or they might offer functionality that is vital for running the organization.
AX 2012 can be integrated with other systems in several ways. For example, your organization
might need to harvest information from old Microsoft Excel fles. To do this, you could write a simple
add-in in Microsoft Visual Studio and easily integrate it with AX 2012. Or your organization might have
an earlier system that is physically located in a distant location and that requires invoice information
to be sent to it in a fail-safe manner. In this case, you could set up a message queue to perform the
transfers. You could use the Microsoft .NET Framework to interact with the message queue from
within AX 2012.
The frst part of this chapter describes some of the techniques that you can use to integrate AX 2012
with other systems by taking advantage of managed code through X++ code. One way is to consume
managed code directly from X++ code; another way is to author or extend existing business logic
in managed code by using the Visual Studio environment. To facilitate this interoperability, AX 2012
provides the managed code with managed classes (called proxies) that represent X++ artifacts. This
allows you to write managed code that uses the functionality these proxies provide in a typesafe and
convenient manner.
76 PART I A tour of the development environment
Although it has long been possible to author managed code that can call back into X++, one piece
has been missing, without which the story has been incomplete: there has been no easy way to access
data in the Microsoft Dynamics AX data stack from managed code. AX 2012 R3 solves this problem
by introducing a LINQ provider. LINQ, short for Language-Integrated Query, is a Microsoft technology
that allows a developer to supply a back-end database to a data provider and then query the data
from any managed language. The second part of this chapter describes how to use LINQ to retrieve
and manipulate AX 2012 R3 data through managed code.
Integrating AX 2012 with other systems
This section describes some of the techniques that you can use to integrate AX 2012 with other systems.
The .NET Framework provides access to the functionality that allows you to do so, and this functional-
ity is used in AX 2012.
Note You can also make AX 2012 functionality available to other systems by using services.
For more information, see Chapter 12, AX 2012 services and integration.
Using third-party assemblies
Sometimes, you can implement the functionality that you are looking to provide by using a managed
component (a .NET assembly) that you purchase from a third-party vendor. Using these dynamic-link
libraries (DLLs) can beand often ismore cost effective than writing the code yourself. These
comp onents are wrapped in managed assemblies in the form of .dll fles, along with their Program
Database (.pdb) fles, which contain symbol information that is used in debugging, and their XML fles,
which contain documentation that is used for Microsoft IntelliSense in Visual Studio. Typically, these
assemblies come with an installation program that often installs the assemblies in the global assembly
cache (GAC) on the computer that consumes the functionality. This computer can be on the client tier,
on the server tier, or on both. Only assemblies with strong names can be installed in the GAC.
Using strong-named assemblies
It is always a good idea to use a DLL that has a strong name, which means that the DLL is signed by
the author, regardless of whether the assembly is stored in the GAC. This is true for assemblies that
are installed on both the client tier and the server tier. A strong name defnes the assemblys identity
by its simple text name, version number, and culture information (if provided)plus a public key and
a digital signature. Assemblies with the same strong name are expected to be identical.
CHAPTER 3 AX 2012 and .NET 77
Strong names satisfy the following requirements:
Guarantee name uniqueness by relying on unique key pairs. No one can generate the
same assembly name that you can, because an assembly generated with one private key has
a different name than an assembly generated with another private key.
Protect the version lineage of an assembly. A strong name can ensure that no one can
produce a subsequent version of your assembly. Users can be sure that the version of the
assembly that they are loading comes from the same publisher that created the version the
application was built with.
Provide a strong integrity check. Passing the .NET Framework security checks guarantees
that the contents of the assembly have not been changed since it was built. Note, however,
that by themselves, strong names do not imply a level of trust such as that provided by a digital
signature and supporting certifcate.
When you reference a strong-named assembly, you can expect certain benefts, such as versioning
and naming protection. If the strong-named assembly references an assembly with a simple name,
which does not have these benefts, you lose the benefts that you derive by using a strong-named
assembly and open the door to possible DLL conficts. Therefore, strong-named assemblies can refer-
ence only other strong-named assemblies.
If the assembly that you are consuming does not have a strong name, and is therefore not installed
in the GAC, you must manually copy the assembly (and the assemblies it depends on, if applicable) to
a directory where the .NET Framework can fnd it when it needs to load the assembly for execution.
It is a good practice to place the assembly in the same directory as the executable that will ultimately
load it (in other words, the folder on the client or the server in which the application is located). You
might also want to store the assembly in the Client\Bin directory (even if it is used on the server exclu-
sively), so that the client can pick it up and use it for IntelliSense.
Referencing a managed DLL from AX 2012
AX 2012 does not have a built-in mechanism for bulk deployment or installation of a particular DLL
on client or server computers, because each third-party DLL has its own installation process. You must
do this manually by using the installation script that the vendor provides or by placing the assemblies
in the appropriate folders.
After you install the assembly on the client or server computer, you must add a reference to the
assembly in AX 2012 so that you can program against it in X++. You do this by adding the assembly
to the References node in the Application Object Tree (AOT): right-click the References node, and then
click Add Reference. A dialog box like the one shown in Figure 3-1 appears.
78 PART I A tour of the development environment
FIGURE 3-1 Adding a reference to a third-party assembly.
The top pane of the dialog box shows the assemblies that are installed in the GAC. If your assem-
bly is installed in the GAC, click Select to add the reference to the References node. If the assembly is
located in either the Client\Bin or the Server\Bin binary directory, click Browse. A fle browser dialog
box will appear where you can select your assembly. After you choose your assembly, it will appear in
the bottom pane and will be added when you click OK.
Coding against the assembly in X++
After you add the assembly, you are ready to use it from X++. If you install the code in the Client\Bin
directory, IntelliSense features are available to help you edit the code. You can now use the managed
code features of X++ to instantiate public managed classes, call methods on them, and so on. For
more information, see Chapter 4, The X++ programming language.
Note that there are some limitations to what you can achieve in X++ when calling managed code.
One such limitation is that you cannot easily code against generic types (or execute generic methods).
CHAPTER 3 AX 2012 and .NET 79
Another stems from the way the X++ interpreter works. Any managed object is represented as an
instance of type ClrObject, and this has some surprising manifestations. For instance, consider the fol-
lowing code:
static void TestClr(Args _args)
{
if (System.Int32::Parse("0"))
{
print "Do not expect to get here";
}
pause;
}
Obviously, you wouldnt expect the code in the if statement to execute because the result of the
managed call is 0, which is interpreted as false. However, the code actually prints the string literal be-
cause the return value of the call is a ClrObject instance that is not null (in other words, true). You can
solve these problems by storing results in variables before use. The assignment operator will correctly
unpack the value, as shown in the following example:
static void TestClr(Args _args)
{
int i = System.Int32::Parse("0");
if (i)
{
print "Do not expect to get here";
}
pause;
}
Writing managed code
Sometimes your requirements cannot be satisfed by using an existing component and you have to
roll up your sleeves and develop some codein either C# or Microsoft Visual Basic .NET. AX 2012 has
great provisions for this. The integration features of AX 2012 and Visual Studio give you the luxury of
dealing with X++ artifacts (classes, tables, and enumerations) as managed classes that behave the way
that a developer of managed code would expect. The Microsoft Dynamics AX Business Connector
(BC.NET) manages the interaction between the two environments. Broadly speaking, you can create a
project in Visual Studio as you normally would, and then add that project to the Visual Studio Projects
node in the AOT. This section walks you through the process.
This example shows how to create managed code in C# (Visual Basic .NET could also be used)
that reads the contents of an Excel spreadsheet and inserts the contents into a table in AX 2012. This
example is chosen to illustrate the concepts described in this chapter rather than for the functionality
it provides.
80 PART I A tour of the development environment
Note The example in this section requires the Microsoft.ACE.OLEDB.12.0 provider to read
data from Excel. You can download the provider from http://www.microsoft.com/en-us
/download/confrmation.aspx?id=23734.
The process is simple. You author the code in Visual Studio, and then add the solution to Applica-
tion Explorer, which is just the name for the AOT in Visual Studio. Then, functionality from AX 2012 is
made available for consumption by the C# code, which illustrates the proxy feature.
Assume that the Excel fle contains the names of customers and the date that they registered as
customers with your organization, as shown in Figure 3-2.
FIGURE 3-2 Excel spreadsheet that contains a customer list.
Also assume that youve defned a table (called, for example, CustomersFromExcel) in the AOT
that will end up containing the information, subject to further processing. You could go about read-
ing the information from the Excel fles from X++ in several ways. One way is by using the Excel auto-
mation model; another is by manipulating the Offce Open XML document by using the XML classes.
However, because it is so easy to read the contents of Excel fles by using ADO.NET, this is what you
decide to do. You start Visual Studio, create a C# class library called ReadFromExcel, and then add the
following code:
CHAPTER 3 AX 2012 and .NET 81
using System;
using System.Collections.Generic;
using System.Text;

namespace Contoso
{
using System.Data;
using System.Data.OleDb;
public class ExcelReader
{
static public void ReadDataFromExcel(string filename)
{
string connectionString;
OleDbDataAdapter adapter;
connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;"
+ "Data Source=" + filename + ";"
+ "Extended Properties=Excel 12.0 Xml;"

+ "HDR=YES"; // Since sheet has row with column titles

adapter = new OleDbDataAdapter(
"SELECT * FROM [sheet1$]",
connectionString);
DataSet ds = new DataSet();
// Get the data from the spreadsheet:
adapter.Fill(ds, "Customers");
DataTable table = ds.Tables["Customers"];
foreach (DataRow row in table.Rows)
{
string name = row["Name"] as string;
DateTime d = (DateTime)row["Date"];
}
}
}
}
The ReadDataFromExcel method reads the data from the Excel fle given as a parameter, but it does
not currently do anything with that data. You still need to establish a connection to the AX 2012
system to store the values in the table. There are several ways of doing this, but in this case, you will
simply use the AX 2012 table from the C# code by using the proxy feature.
The frst step is to make the Visual Studio project (that contains the code) an AX 2012 citizen. You
do this by selecting the Add ReadFromExcel To AOT menu item on the Visual Studio project. After you
do this, the project is stored in the AOT and can use all of the functionality that is available for nodes
in the AOT. The project can be stored in separate layers, can be imported and exported, and so on.
82 PART I A tour of the development environment
The project is stored in its entirety, and you can open Visual Studio to edit the project by clicking Edit
on the context menu, as shown in Figure 3-3.
FIGURE 3-3 Context menu for Visual Studio projects that are stored in the AOT.
Tip You can tell that a project has been added to the AOT because the Visual Studio project
icon is updated with a small Microsoft Dynamics AX icon in the lower-left corner.
With that step out of the way, you can use the version of the AOT that is available in Application
Explorer in Visual Studio to fetch the table to use in the C# code (see Figure 3-4). If the Application
Explorer window is not already open, you can open it by clicking Application Explorer on the View
menu.
You can then create a C# representation of the table by dragging the table node from Application
Explorer into the project.
CHAPTER 3 AX 2012 and .NET 83
FIGURE 3-4 Application Explorer with an AX 2012 project open.
After you drag the table node into the Visual Studio project, you will fnd an entry in the project
that represents the table. The items that you drag into the project in this way are now available to
code against in C#, just as though they had been written in C#. This happens because the drag opera-
tion creates a proxy for the table under the covers; this proxy takes care of the plumbing required
to communicate with the AX 2012 system, while presenting a high-fdelity managed interface to the
developer.
You can now proceed by putting the missing pieces into the C# code to write the data into the
table. Modify the code as shown in the following example:
DataTable table = ds.Tables["Customers"];
var customers = new ReadFromExcel.CustomersFromExcel();
foreach (DataRow row in table.Rows)
{
string name = row["Name"] as string;
DateTime d = (DateTime)row["Date"];
customers.Name = name;
customers.Date = d;
customers.Write();
}
84 PART I A tour of the development environment
Note The table from AX 2012 is represented just like any other type in C#. It supports
IntelliSense, and the documentation comments that were added to methods in X++ are
available to guide you as you edit.
The data will be inserted into the CustomersFromExcel table as it is read from the ADO.NET table
that represents the contents of the spreadsheet. However, before either the client or the server can
use this code, you must deploy it. You can do this by setting the properties in the Properties window for
the AX 2012 project in Visual Studio. In this case, the code will run on the client, so you set the Deploy to
Client property to Yes. There is a catch, though: you cannot deploy the assembly to the client when the
client is running, so you must close any AX 2012 clients prior to deployment.
To deploy the code, right-click the Visual Studio project, and then click Deploy. If all goes well, a
Deploy Succeeded message will appear in the status line.
Note You do not have to add a reference to the assembly, because a reference is added
implicitly to projects that you add to the AOT. You need to add references only to assem-
blies that are not the product of a project that has been added to the AOT.
As soon as you deploy the assembly, you can code against it in X++. The following example illus-
trates a simple snippet in an X++ job:
static void ReadCustomers(Args _args)
{
ttsBegin;
Contoso.ExcelReader::ReadDataFromExcel(@"c:\Test\customers.xlsx");
ttsCommit;
}
When this job runs, it calls into the managed code and inserts the records into the AX 2012 database.
Debugging managed code
To ease the process of deploying after building, Visual Studio properties let you defne what hap-
pens when you run the AX 2012 project. You manage this by using the Debug Target and Startup
Element properties. You can enter the name of an element to executetypically, a class with a suit-
able main method or a job. When you start the project in Visual Studio, it will create a new instance
of the client and execute the class or job. The X++ code then calls back into the C# code where
breakpoints are set. For more information, see Debugging Managed Code in Microsoft Dynamics
AX at http://msdn.microsoft.com/en-us/library/gg889265.aspx.
CHAPTER 3 AX 2012 and .NET 85
An alternative to using this feature is to attach the Visual Studio debugger to the running AX 2012
client (by clicking Attach To Process on the Debug menu in Visual Studio). You can then set break-
points and use all of the functionality of the debugger that you normally would. If you are running
the Application Object Server (AOS) on your own computer, you can attach to that as well, but you
must have administrator privileges to do so.
Important Do not debug in a production environment.
Proxies
As you can see, getting managed code to work with AX 2012 is quite simple because of the proxies
that are generated behind the scenes to represent the AX 2012 tables, enumerations, and classes.
In developer situations, it is standard to develop the artifacts in AX 2012 iteratively and then code
against them in C#. This process is seamless because the proxies are regenerated by Visual Studio
at build time and thus are always synchronized with the corresponding artifacts in the AOT; in other
words, the proxies never become out of date. In this way, proxies for AX 2012 artifacts differ from
Visual Studio proxies for web services. Proxies for web services are expected to have a stable application
programming interface (API) so that the server hosting the web service is not contacted every time the
project is built. Proxies are generated not only for the items that the user has chosen to drop onto the
Project node as described previously. For instance, when a proxy is generated for a class, proxies will
also be generated for all of its base classes, along with all artifacts that are part of the parameters for
any methods, and so on.
To see what the proxies look like, place the cursor on a proxy name in the code editor, such as
CustomersFromExcel in the example, right-click, and then click Go To Defnition (or use the convenient
keyboard shortcut F12). All of the proxies are stored in the Obj/Debug folder for the project. If you look
carefully, you will notice that the proxies use BC.NET to do the work of interfacing with the AX 2012
system. BC.NET has been completely rewritten from the previous version to support this scenario;
in earlier versions of the product, BC.NET invariably created a new session through which the interaction
occurred. This is not the case for the new version of BC.NET (at least when it is used as demonstrated
here). That is why the transaction that was started in the job shown earlier is active when the records
are inserted into the table. In fact, all aspects of the users session are available to the managed code.
This is the crucial difference between authoring business logic in managed code and consuming the
business logic from managed code. When you author business logic, the managed code becomes an
extension to the X++ code, which means that you can crisscross between AX 2012 and managed code
in a consistent environment. When consuming business logic, you are better off using the services
framework that AX 2012 provides and then consuming the service from your application. This has big
benefts in terms of scalability and deployment fexibility.
86 PART I A tour of the development environment
Figure 3-5 shows how BC.NET relates to AX 2012 and .NET application code.
FIGURE 3-5 Interoperability between AX 2012 and .NET code through BC.NET.
To demonstrate the new role of BC.NET, the following example opens a form in the client that
called the code:
using System;
using System.Collections.Generic;
using System.Text;

namespace OpenFormInClient
{
public class OpenFormClass
{
public void DoOpenForm(string formName)
{
Args a = new Args();
a.name = formName;
var fr = new FormRun(a);
fr.run();
fr.detach();
}
}
}
In the following example, a job is used to call managed code to open the CustTable form:
static void OpenFormFromDotNet(Args _args)
{
OpenFormInClient.OpenFormClass opener;
opener = new OpenFormInClient.OpenFormClass();
opener.DoOpenForm("CustTable");
}
CHAPTER 3 AX 2012 and .NET 87
Note The FormRun class in this example is a kernel class. Because only an application class
is represented in Application Explorer, you cannot add this proxy by dragging it as described
earlier. Instead, drag any class from Application Explorer to the Visual Studio project, and
then set the fle name property of the class to Class.<kernelclassname>.axproxy. In this ex-
ample, the name would be Class.FormRun.axproxy.
This would not have been possible with earlier versions of BC.NET because they were basically face-
less clients that could not display any user interface. Now, BC.NET is actually part of the client (or server),
and therefore it can do anything the client or server can. In AX 2012 R2, you can still use BC.NET as a
stand-alone client, but that is not recommended because that functionality is now better implemented
by using services (see Chapter 12). The Business Connector that is included with AX 2012 is built with
.NET Framework 3.5. That means that it is easier to build the business logic with this version of .NET; if
you cannot do that for some reason, you must add markup to the App.confg fle to compensate. If you
are using a program that is running .NET Framework 4.0 and you need to use BC.NET through the
proxies as described, you would typically add the following markup to the App.confg fle for your
application:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Hot swapping assemblies on the server
The previous section described how to express business logic in managed code. To simplify the
scenario, code running on the client was used as an example. This section describes managed code
running on the server.
You designate managed code to run on the server by setting the Deploy to Server property for the
project to Yes, as shown in Figure 3-6.
FIGURE 3-6 Property sheet showing the Deploy to Server property set to Yes.
88 PART I A tour of the development environment
When you set this property as shown in Figure 3-6, the assembly is deployed to the server direc-
tory. If the server has been running for a while, it typically will have loaded the assemblies into the
current application domain. If Visual Studio were to deploy a new version of an existing assembly,
the deployment would fail because the assembly would already be loaded into the current applica-
tion domain. To avoid this situation, the server has the option to start a new application domain
in which it executes code from the new assembly. When a new client connects to the server, it will
execute the updated code in a new application domain while already-connected clients continue to
use the old version.
To use the hot-swapping feature, you must enable the option in the Microsoft Dynamics AX Server
Confguration Utility by selecting the Allow Hot Swapping Of Assemblies When The Server Is Running
check box, as shown in Figure 3-7. To open the Microsoft Dynamics AX Server Confguration Utility,
on the Start menu, point to Administrative Tools, and then click Microsoft Dynamics AX 2012 Server
Confguration.
FIGURE 3-7 Allow hot swapping by using the Microsoft Dynamics AX Server Confguration Utility.
CHAPTER 3 AX 2012 and .NET 89
Note The example in the previous section illustrated how to run and debug managed
code on the client, which is safe because the code runs only on a development computer.
You can debug code that is running on the server (by starting Visual Studio as a privileged
user and attaching to the server process, as described in the Debugging managed code
section earlier in this chapter). However, you should never do this on a production server
because any breakpoints that are encountered will stop the managed code from running,
essentially blocking any users who are logged on to the server and processes that are run-
ning. Also, you should not use hot swapping in a production scenario because calling into
another application domain exacts a performance overhead. The feature is intended only
for development scenarios, where the performance of the application is irrelevant.
Using LINQ with AX 2012 R3
As mentioned earlier, LINQ allows anyone to supply a back-end database to a data provider and
then query the data in a natural way from any managed language. In addition to the AX 2012 R3
LINQ provider, there are LINQ providers for many data storage systems, from managed object graphs
to Active Directory to traditional back-end databases such as Microsoft SQL Server.
LINQ has two parts:
Native support in the C# and Visual Basic .NET compilers, which makes many (but not all)
queries easy to read and write.
Language features that make the extension and use of LINQ queries possible. These features
provide a layer of syntactic sugarshortcuts to achieving results that can be expressed in
the language in other ways. The following sections discuss these features briefy because
they are crucial to understanding how LINQ queries work and how to use them. Later
sections describe how to go beyond the syntactic sugar when you need to so that you
can achieve the results you want.
The var keyword
By using the var keyword in declarations, you can omit the variable type, because the type is deter-
mined by the value that the variable is initialized to, as shown in the following example:
var i = 9;
As it turns out, using LINQ requires that you be able to return values of types that cannot be de-
scribed in the source language (the so-called anonymous types), which is why the var keyword was
introduced. You'll see how this works in the Anonymous types section later in this chapter.
90 PART I A tour of the development environment
Extension methods
Extension methods are a means of adding methods to classes that you cannot modify, either because
the classes are sealed or because you do not have the source code. You can use extension methods to
add methods to such classes and call them as if the method were defned on that class. However, the
method can access only public members of the class.
In the following code, a static class called MyExtensions is defned. (The name of the extension class
is arbitrary.) This class features a public static method, RemoveUnderscores, which is an extension
method of the string type. The type is defned through the use of the this keyword on the frst param-
eter; subsequent parameters become parameters of the extension method.
static class MyExtensions
{
public static string RemoveUnderscores(this string arg)
{
return arg.Replace("_", "");
}
}
Because this method is a string extension method, you can use it just like any other string method:
void Main()
{
Console.WriteLine("The_Rain_In_Spain".RemoveUnderscores());
}
Anonymous types
Anonymous types provide a convenient way for you to encapsulate a set of read-only properties into
a single object without having to explicitly defne a type for the object frst. The name of the type is
generated by the C# compiler and is not available at the source-code level.
You create anonymous types by using the new operator together with an object initializer. Anony-
mous types are typically used in the select clause of LINQ queries, but they don't have to be. The
following code contains an example of an anonymous type. Note that the type cannot be described
in the language, so the var keyword is used.
public static void Test()
{
var myValue = new { Name = "Jones", Age = 43 };
Console.WriteLine("Name = {0}, Age = {1}", myValue.Name, myValue.Age);
}
Even though the type of myValue cannot be declared, the compiler and IntelliSense recognize the
type, so the feld names defned in the type can be used, as shown in the code.
CHAPTER 3 AX 2012 and .NET 91
Lambda expressions
Lambda expressions are nameless functions that take zero or more arguments. A special syntax was
introduced for them, as shown in the following example:
(Argument,) => body
This syntax makes lambda expressions easy to use. The following lambda function accepts an integer
argument and returns an integer value:
Func<int,int> x = e => e + 4;
You will need lambda expressions when you use unsugared syntax for LINQ queries. In later sec-
tions, you will see several ways in which these lambda expressions are used.
Now that you know what you need to know about how C# makes LINQ queries possible, you are
ready to start using LINQ to access AX 2012 R3 data.
Walkthrough: constructing a LINQ query
This section contains a walkthrough that shows you how to build the components you'll need to run
the examples in this chapter.
Create tables
The examples use two tables: one to contain records representing people and the other to contain
records representing loans. In AX 2012 R3, defne the tables as follows:
The Person table contains the following felds, in addition to the system felds:
FirstName: string

LastName: string

Age: real

Income: real
For good measure, put in an index on the RecId system feld.
The Loan table is even simpler, consisting only of two felds:
Amount: real

PersonId: RefRecId
The table represents loans that are taken by people referenced in the PersonId feld.
92 PART I A tour of the development environment
You might fnd it useful to add some sample data to the tables and check to ensure that the results
are what you expect. Either you can create some simple forms to do this, or you can run the following
X++ code to insert data to use when you run the examples:
static void PopulateLinqExampleData(Args _args)
{
Person pTbl;
Loan lTbl;
int i;

void InsertPerson(str fName, str lName, int age, real income)
{
Person p;
p.FirstName = fName;
p.LastName = lName;
p.Age = age;
p.Income = income;
p.insert();
}

void InsertLoan(String30 personLastName, real loanAmount)
{
Person person;
Loan l;
int personID;

select * from person where person.LastName == personLastName;

l.PersonID = person.RecID;
l.Amount = loanAmount;
l.insert();
}

// Make sure there is no data in the table before insert
delete_from pTbl;
delete_from lTbl;


//Add person data.
for(i=0; i<20; i++)
{
InsertPerson('FirstName' + int2str(i), 'LastName' + int2str(i),
25 + 2*i, 10000 + i * 1000);
}


//Insert a few loans.
InsertLoan('LastName0', 6400);
InsertLoan('LastName0', 5400);
InsertLoan('LastName4', 13450);
InsertLoan('LastName8', 100);
InsertLoan('LastName10', 48000);
InsertLoan('LastName8', 17850);
InsertLoan('LastName15', 32000);
}
CHAPTER 3 AX 2012 and .NET 93
Create a console application
The next step is to create a simple console application to run the queries:
1. In Visual Studio, create a C# console application called LinqProviderSample, and add refer-
ences to the DLLs necessary to run LINQ queries. These DLLs are located in the clients \bin
directory in your AX 2012 R3 installation:

Microsoft.Dynamics.AX.Framework.Linq.Data.dll

Microsoft.Dynamics.AX.Framework.Linq.Data.Interface.dll

Microsoft.Dynamics.AX.Framework.Linq.Data.ManagedInteropLayer.dll

Microsoft.Dynamics.AX.ManagedInterop.dll

Microsoft.Dynamics.AX.ManagedInteropCore32.dll
2. To use the two tables you just created, you'll need to add a proxy for each of them so that
you can consume their data and methods in a typesafe manner. To do this, open Visual Studio
Application Explorer and drag the two tables you created earlier into your project, as shown
in Figure 3-8. This action causes tooling in Visual Studio to generate proxies for the tables, in
addition to other proxies that are needed.
FIGURE 3-8 LinqProviderSample in Visual Studio.
94 PART I A tour of the development environment
3. Now you are ready to add some code for your console application. The frst example will just
write the contents of the Person table out to the console.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Dynamics.AX.Framework.Linq.Data;
using Microsoft.Dynamics.AX.ManagedInterop;
namespace Test
{
class Program
{
static void Main(string[] args)
{
// Log on to AX 2012 R3. Create a session and log on.
Session axSession = new Session();
axSession.Logon(null, null, null, null);

// Create a provider needed by LINQ and create a collection of customers.
QueryProvider provider = new AXQueryProvider(null);

var people = new QueryCollection<Person>(provider);
var peopleQuery = from p in people select p;
foreach (var person in peopleQuery)
{
Console.WriteLine(person.LastName);
}

axSession.Logoff();
}
}
}
The Main method frst creates a session that serves as the connection to the AX 2012 R3 system.
In this case, you are logging on by using the default credentials for the computer. The query provider
instance (called provider) is a handle that is used to provide a collection of objects that is then used
in the query. The people variable holds such an instance, and it is used in the peopleQuery query.
The query is used in a foreach loop to traverse the person records and show the name recorded on
each one.
Note that the query is not actually executed before the frst data is requested. In other words, the
query declaration does not cause any requests to be made to SQL Server before the foreach statement
executes. This fact allows you to build composable queriesthat is, you can build queries in steps, add-
ing criteria as needed, until the frst data is requested. You will see examples of composable queries in
the following walkthroughs.
CHAPTER 3 AX 2012 and .NET 95
Using queries to read data
The walkthrough in the previous section gave you a taste of how to read data from the AX 2012 R3
data stack through the Microsoft Dynamics AX LINQ provider. This section goes a little deeper into
how to use the LINQ provider to build queries to solve data access problems in C#.
where clauses
The query in the previous walkthrough is very basicit does not even flter the records that were
returned on any particular criterion. To flter the records, you need to provide a where clause that
expresses the criterion that must be satisfed by the records selected.
Suppose that you want to return a list of people who are older than 70. You can get this set of
people by adding a where clause to the query:
QueryCollection<Person> people = new QueryCollection<Person>(provider);
...
var query = from p in people
where p.Age > 70
select p;
The expression provided after the where keyword can be any valid C# expression that evaluates to
a Boolean value (true or false). Often, the where clause will contain references to a record instance (in
this case, type Person). The name of this variable (p in this case) is provided in the from clause.
order by clauses
Sometimes, you might want to guarantee that records arrive in a predefned order. In X++, you would
apply an order by clause, and that is exactly what you do with LINQ:
var query = from p in people
where p.Age > 70
orderby p.AccountNum
select p;
You can also specify whether the order is ascending (the default) or descending by using the
proper keyword:
var query = from p in people
where p.Age > 70
orderby p.AccountNum descending
select p;
96 PART I A tour of the development environment
join clauses
Selecting data from only one table is not very useful. You need to be able to select records from mul-
tiple tables at the same time and perform joins on the result. Not surprisingly, LINQ queries include a
join clause that you can use for this purpose:
QueryCollection<Person> people = new QueryCollection<Person>(provider);
QueryCollection<Loan> loans = new QueryCollection<Loan>(provider);

var personWithLargeLoan =
from l in loans
join p in people on l.PersonID equals p.RecId
where l.Amount > 20000
select new { Name = p.LastName + " " + p.FirstName, Amount = l.Amount };
When this query executes, it returns a value that contains the name and loan amount of every per-
son who has a loan with an amount greater than 20,000. The person and the loan are tied together by
the join on clause. The value returned is the frst example in this chapter where anonymous types
are used. The type of the following expression is anonymous and cannot be declared in C#:
new { Name = p.LastName + " " + p.FirstName, Amount = l.Amount };
Aggregates
Often, you might want to use SQL Server to aggregate the selected data for you. This is the purpose of
the aggregation functions AVG (average), SUM (sum), COUNT, MIN (minimum), and MAX (maximum).
Using these aggregation functions is far more effcient than fetching all of the records, moving them
to the client tier, and doing the calculations there.
The following query calculates the average age of the population represented in the database:
var averageAge = personCollection.Average(pers => pers.Age);
Console.WriteLine(averageAge);
This example uses the extension method approach to LINQ and moves beyond relying on the syn-
tactic sugar that C# provides. Notice that the feld to be averaged (Age) is provided in the form of a
lambda expression, taking a person instance (called pers in this example, but the name is immaterial)
and mapping it onto the age of that person.
The following example expands on that theme. This code contains another lambda expression to
specify the criterion for records to be included in the count:
// Cost of salaries per month
var costOfSalaries = personCollection.Sum(pers => pers.Income);
Console.WriteLine(costOfSalaries);

// Get the number of persons with income greater than 20K
var noOfRecords = personCollection.Where(pers => pers.Income > 20000).Count();
Console.WriteLine(noOfRecords);
CHAPTER 3 AX 2012 and .NET 97
Projections
Projections describe what you are selecting from the records that you are retrieving. In most of the
earlier examples in this chapter, you returned the records themselves, and you saw that you can use
an instance of an anonymous type, which was described earlier as one of the C# features that makes
LINQ queries possible. In this case, a new anonymous type is created that contains the felds Name
and Amount:
var allLoans = from l in loanCollection
join p in personCollection on l.PersonID equals p.RecId
select new {Name = p.LastName + " " + p.FirstName, Amount = l.Amount};
However, the expressions are not limited to anonymous types. In this case, the expression simply
concatenates strings containing a frst and last name into a full name, returning a sequence of strings:
var nameList = from pers in personCollection
select string.Format("{0} {1}", pers.FirstName, pers.LastName);

foreach (var fullName in nameList)
{
Console.WriteLine(fullName);
}
Take and Any extension methods
Imagine that you are interested in retrieving only a predefned number of records. In X++, you can
apply hints to select statements that allow you to fetch 1, 10, 100, or 1,000 elements. But with the
LINQ provider, you can be much more fne-grained in your requests. The Take extension method
lets you specify the number of records to fetch. The following query returns only the frst fve ele-
ments in the Person table, ordered by age:
var take5 = personCollection.OrderBy(p => p.Age).Take(5);
Take is a generalization of the FirstOnly hints that are available in X++. However, FirstOnly hints
exist only for 1, 10, 100, and 1,000 records, whereas you can provide any expression in the Take
extension method.
It is often useful to check whether any records satisfy a particular constraint. You can use the Any
extension method for these scenarios:
var anyone = personCollection.Any();
This statement returns a value of true if there are any records in the Person table. Often, you might
want to check whether some criterion is satisfed by any of the records in the table. For this purpose,
you can apply a lambda expression specifying the criterion in the Any extension method:
var anyone = personCollection.Any(p => p.Income > 100000);
98 PART I A tour of the development environment
Note that the results in this case are not enumerable values; they simply evaluate to a Boolean
value.
You can also check whether a specifed criterion is satisfed for all records:
var adults = personCollection(p => p.Age >= 18);
AX 2012 R3specifc extension methods
The earlier examples in this chapter used both the features provided by the C# compiler to express
the queries and the extension methods that use lambdas. The former led to queries that bear more
than a superfcial resemblance to the queries you would write in many other environments. However,
the AX 2012 R3 data stack has several unique features. These features can be used to good effect in
managed code through LINQ, but the C# compiler obviously has no knowledge of them; they are
accessible only through extension methods, not in the syntax that C# provides. This section illustrates
some of these extension methods.
CrossCompany
You can use the CrossCompany extension method when you want to select data for one or more
named companies.
This example returns a Boolean value that is true if there are any people in the CEC company who
are in an age group that is likely to apply for a home loan:
var people = new QueryCollection<Person>(provider);
var mayLookForHouseLoan = from pers in people
where 30 <= pers.Age && pers.Age <= 40
select pers;

if (onlyInCEC)
{
mayLookForHouseLoan = mayLookForHouseLoan .CrossCompany("CEC").Any();
}

var b = mayLookForHouseLoan .Any(); // Force selection in the database.
You can call the CrossCompany extension method with up to seven strings designating different
companies from which to include data. If you use this extension method without parameters, data
from all companies is included. If you do not include the CrossCompany extension method in your
query, you will get data from the current company only.
This code illustrates the composability of LINQ queries. Because the query is not actually executed
before the frst record is requested (typically in a foreach loop, but here by the usage of the Any
predicate), you can add to it as required by the code. This is not possible in X++.
CHAPTER 3 AX 2012 and .NET 99
validTimeState
Tables can be confgured to include valid time and state information. This is typically done for tables
that contain data that is time sensitive, such as rates of exchange, where the rates are valid only for a
particular time.
Basically, this means that the queries you make against these tables are relative to today's date un-
less you use the validTimeState keyword. You can use the validTimeState extension method to query
for values on the specifed date or within the specifed range, as shown in the following example:
var endOfYearExchangeQueryToday = rates
.Where(rate => rate.From.Compare("USD") && rate.To.Compare("DKK");

var endOfYearExchangeQueryYearEnd = rates
.Where(rate => rate.From.Compare("USD") && rate.To.Compare("DKK")
.Where(rate => rate.ValidFrom.Equal(new DateTime(2013, 12, 31))
Note the second example, in which multiple where clauses are provided to enhance readability.
The system will create the resulting expression at run time.
Updating, deleting, and inserting records
So far, the examples in this chapter have illustrated how to create collections of data and then con-
sume the data from C# by using the LINQ provider. This is certainly an important scenario, but it is
not the only one. There are also situations where you need to update existing data, delete existing
data, and insert new data. As it happens, the way to do this is almost identical to what you would do
in X++.
All of the following examples execute on the client tier; they are not set-based operations. This
is one of the restrictions of the LINQ provider: there is currently no way to collect changes and then
deliver them to the database for batch execution.
Updating records
Suppose you want to increase each person's income by 1,000. The code to do so might look some-
thing like this:
RuntimeContext c = RuntimeContext.Current;

c.TTSBegin();

var updateAblePersonCollection = personCollection.ForUpdate().Take(4);

foreach (var person in updateAblePersonCollection)
{
person.Income = person.Income + 1000;
person.Update();
}

c.TTSCommit();
100 PART I A tour of the development environment
The code is straightforward: you get the current run-time context from the static class called
RuntimeContext. This instance can manage transactions, so you start a transaction, get four records
to update (by using the ForUpdate extension method), and traverse them, adding 1,000 to the income
of each person. When you are fnished updating the felds in the table, you call the Update method
on the table instance. Finally, you save the values by committing the transaction.
Inserting records
Inserting records works along the same lines as updating records. However, no functionality from the
LINQ provider is involved. (The example is included here for the sake of completeness.) The insertion
is accomplished by calling the Insert method on the instance of a table within the scope of a transac-
tion. The following example defnes a new record for the Person table, inserts the record, and then
commits the transaction:
RuntimeContext c = RuntimeContext.Current;

c.TTSBegin();
var newPers = new Person();

newPers.FirstName = "NewPersonFirstName";
newPers.LastName = "NewPersonLastName";
newPers.Age = 50;
newPers.Income = 56000;
newPers.Insert();

c.TTSCommit();
Deleting records
Deleting records is as simple as updating records, as you can see from the following code. The follow-
ing example deletes all loan records that have a balance of zero:
c.TTSBegin();

var loansToDelete = loans.ForUpdate().Where(p => p.Amount == 0.0m);
foreach (var loan in loansToDelete )
{
loan.Delete();
}

c.TTSCommit();
The deletion is performed by calling the Delete method on the table instance inside a transaction.
Note that the records must be selected by using the ForUpdate extension method, as shown.
CHAPTER 3 AX 2012 and .NET 101
Limitations
As described earlier, the C# compiler has some built-in knowledge of LINQ syntax, but C# has no
knowledge of the actual provider that is used to fetch the data at run time. A query that you author
in C# is transformed into a format that can retrieve data from a specifc data provider (in this case,
AX 2012 R3) at run time. This has the following consequences:
Overhead is exacted before records are fetched, because the LINQ provider must convert the
query from C# to a data structure that is known to the AOS. For information about how to
limit this overhead, see the next section, Advanced: Limiting overhead.
Some queries can be represented perfectly in C# but fail at run time because of limitations of
the back-end data provider. This is a result of the architecture of LINQ. For example, the AX
2012 R3 data access stack does not support HAVING clauses (criteria used to select groups
introduced with GROUP BY clauses). You might be tempted to write a query in C# such as the
following:
var ages = from person in personCollection
group person by person.Age into ageGroup
where ageGroup.Count() > 4
select ageGroup;
However, this query would fail at run time because the back end does not support it.
Advanced: limiting overhead
This section takes a closer look at how the C# compiler compiles a LINQ query. The following discus-
sion pertains both to queries written in sugared and unsugared syntax: the compiler removes the
syntactic sugar at compile time.
The C# compiler compiles the lambdas that are used as arguments to the extension methods into
code that generates a tree structure at run time. As described earlier, this tree must be converted
to the data structure that the AOS can use every time a query executes. This happens to be another
tree structurethe same tree that the X++ compiler would have built for the same query. The AOS
does not know whether the query it is executing comes from X++ or through the LINQ provider. This
transformation from one tree structure to another means that LINQ queries exact a certain amount
of overhead. For some scenarios, it is valuable to limit this overhead so that it occurs only once. You
can accomplish this by compiling the queries before they are used. The key to understanding why
this works lies in the difference between lambda functions expressed as functions that can be exe-
cuted and their expression trees.
When lambdas were introduced earlier, the type of the lambda was specifed as Func<int, int>:
Func<int, int> l = e => e + 4;
102 PART I A tour of the development environment
This is obviously a function taking an integer argument and returning an integer value. The conven-
tion taken by the C# compiler and .NET is that a lambda function returning a value of type T and
taking multiple parameters of type P
i
has the following type:
Func<P
1
, P
2
, , P
n
, T>
These values can be used to call the lambda function:
Console.WriteLine("The value is {0}", l(9)); //Returns 9 + 4 = 13.
However, there is another way to interpret lambda functions. Instead of being treated as functions,
they can be treated directly as the trees they form. This is accomplished by introducing the type
Expression<>:
Expression<Func<int, int>> expression = e => e + 4;
Values of this type cannot be invoked to calculate a value, but you can certainly inspect them in
the debugger, as shown in Figure 3-9.
FIGURE 3-9 Visual Studio debugger containing lambda functions.
CHAPTER 3 AX 2012 and .NET 103
This provides a glimpse into how the LINQ provider works: the expression is a value containing the
lambda function broken down into its constituent parts. This tree is what is converted into a value that
can be interpreted by the AOS.
Such expression values have an important property. They can be compiled into a delegate by using
the .Compile() method:
var compiledexpression = expression.Compile();
The compiled expression is now executable, so you can do the following:
Console.WriteLine("The value is {0}", compiledExpression(9)); // returns 9 + 4 = 13.
Because the compilation has now taken place, no further processing is required every time the
query is called.
An example will make this easier to understand. Reconsider the example shown earlier in the sec-
tion about the CrossCompany extension method, where the records representing people in the age
range of 30 through 40 were selected. For the purposes of this example, this selection has been gen-
eralized to a query that takes two parameters that hold the ages at the top and bottom of the range
that is being requested, as shown in the following code:
int fromAge, toAge;

var personBetweenAges = from pers in personCollection
where fromAge <= pers.Age && pers.Age <= toAge
select pers;

foreach (var person in personBetweenAges)
{
Console.WriteLine("{0}", person.Age);
}
The next step is to wrap the query into a function that takes the required parameters:
The query collection from which to pick the people
The from age
The to age
104 PART I A tour of the development environment
The ternary function returns an instance of the IQueryable<Person> interface. The code looks
like this:
Func<QueryCollection<Person>, int, int, IQueryable<Person>> generator =
(collection, f, t) => collection.Where(p => (f <= p.Age && p.Age <= t));
This can readily be transformed into the corresponding tree:
Expression< Func<QueryCollection<Person>, int, int, IQueryable<Person>>> tree =
(collection, f, t) => collection.Where(p => p.Age > f && p.Age < t);
This, in turn, can be compiled into a delegate:
var compiledQuery = tree.Compile();
The end result is a delegate that can be called with the parameters you want:
foreach (var p in compiledQuery(personCollection, 30, 40))
{
Console.WriteLine("{0}", p.Age);
}
You can repeat this call any number of times without incurring the cost of the compilation.
This page intentionally left blank
Index
775
A
abstract tables, in inheritance hierarchy, 622
acceptance test driven development (ATDD), 557, 558,
566
access control
defned, 373
security roles, managing through, 375
access operators, X++ expressions, 113
accessing data with queries, 299
accounting
distribution process, 704
events, documenting, 702
requirements, deriving, 698
accounting framework, 698702
action controls
Action pane strips, 188
Action panes, 188
buttons, 187
action icons, 60
action menu items, 264
Action pane
described, 188
designing for ease of use, 169
details forms, displaying in, 165
Enterprise Portal, using with, 170
organizing by activity, 163
strips, 188
web part in Enterprise Portal, 211
actions, 26
activating a workfow, 283287
activity entity, 688692
address bar, 155
address book framework, integrating, 675
ad hoc mode, using, 482, 483
ad hoc reports, 293
aggregates, 96
AJAX, 233
alert notifcations, displaying on webpages, 213
ALM. See application life cycle management (ALM)
alternate key columns, 52
alternate keys, 614
analytic content
confguring, 325, 326
Role Centers, displaying in, 351
anonymous types, 90
anytype
reference type, 108
variable declaration, 111
AOS. See Application Object Server (AOS)
AOT. See Application Object Tree (AOT)
APIs
Batch, 652654
document services, provided by, 412
model store, 740
one-way messages, using to send, 433
QueryFilter, 635638
refection, 711724
securing, 392
application data element types, 918
application development environments, 6
Application Integration services, 8
application life cycle management (ALM)
benchmarking, 773
deploying customizations, 768
life cycle phases, 761
Lifecycle Services (LCS), 762768
solution, tracking with, 556
application model elements, updating with MorphX, 19
Application Object Server (AOS)
client confguration, 486
confguration, 486, 655, 659
Help system, and, 573
improving performance of, 486
report execution sequence, in, 293
system services, 407, 408
Application Object Tree (AOT)
assemblies, referencing, 77
autorefresh, enforcing, 25
chart controls, managing, 304
dirty elements, 25
document set properties, setting, 597
elements, 20, 22, 2426
elements, Enterprise Portal, 213
776
Application Object Tree (AOT) (continued)
jobs, creating with, 106
Label Files node, 34
layers and models, 26
manual resolution, 25
modeling capabilities, 326
navigating, 21
opening, 21
projects, maintaining in, 340
publishing services, 421
subnodes, changing the order, 24
synchronizing elements, 25
application platform architecture
data element types, 9
development environments, 6
layers, 5
tiers, 7, 8
approvals workfow element, 264, 277
architecture
application meta-model, 9
application platform, 6
client-side reporting solutions, 290, 291
design principles, 3
DIXF, components of, 772
Enterprise Portal, described, 208
layers, 4
mobile, 746751, 758
security, in AX 2012, 372
server-side reporting solutions, 292
area pages, 158160
Arithmetic operators, expressions, 113
artifacts
ALM solution, tracking with, 556
custom services, 408
document services, 412, 413
security, validating, 384
workfow, 278
ASP.NET controls
Chart Control, 290
User control web part, hosting with, 213
user input, validating, 243
ASP.NET webpages, creating with AJAX, 233
assemblies
coding against, in X++, 78
hot swapping on servers, 87, 88
references, adding, 77
strong-named, using, 76, 77
third-party, 76
assigning security roles, 376, 384
ATDD (acceptance test driven development), 557,
558, 566
attributes
classes and methods, using with, 139
creating, 552
predefned, test, 550552
product, 684
SysObsoleteAttribute, 139
SysOperation framework, 517
authentication
described, 373
mobile apps, 749, 754
Authenticode, signing models with, 734
authorization, 373, 391
auto design reports, 297, 298
Auto variables, 200
auto-inference, 378
automated decisions and tasks, in workfows, 265
autorefresh, 25
avg aggregate functions, in select statements, 119
AX 2012
batch processing, 643, 644
chart development tools, 303
client, Help actions, 571
consuming services, 422432
custom services, 408, 411
data connection queries, 299
designing new transaction details forms, 169
Development Workspace, launching, 20
Enterprise Search, 253
Excel templates, building, 203
extending transaction details forms, 169
extensions, 300
IDs, assigning, 66
integrating with other systems, 74, 7688
labels, 34
localization, allowing for, 36
managed DLLs, referencing from, 77
metadata layers, 727
mobile architecture, 746751
mobile clients, services for, 750, 751
MorphX development tools, 19
print management, 661669
publishing services, 421
reporting development tools, 296
reporting framework architecture, 293
security framework, 372376
send framework, 432434
services framework, 407420, 750
solution, as, 3
SQL Server Power View, 353358
system services, 408
Trustworthy Computing, 390, 393
unit testing features, 550553
value type conversions, 128
version control systems, 65
Word templates, building, 204
AX 2012 R3
extension methods, specifc to, 98, 99
LINQ, using with, 89
Axd<Document> classes, 414
application platform architecture
777
Axd queries, generating document services with, 416
AxPopup controls, 225
Ax<Table> classes, 415
AXUpdatePortal utility parameters, 252, 253
AXUtil, models and, 731, 734
Azure demo environment topology, 766
B
backing entities, creating, 695, 696
base enumeration
types, 9, 111
values, adding, 677, 679
basic integration ports, 421
batch bundling, 488
batch framework
Batch API, using, 652654
common uses, 643, 644
described, 641
requirements, 516
batch groups, 643, 656
batch jobs
batch-executable classes, creating, 645647
creating, 647654
described, 643
managing, 657, 658
task dependencies, 650653
batch processing, 643, 644
batch servers
AOS instances, confguring as, 655
described, 643
operations, running on, 517
batch tasks
debugging, 658660
described, 643
batch-executable classes, creating, 645647
benchmarking, 773
best practices
mobile apps, 753
rules, 41, 43
washed version, 57
Best Practices tool
application logic, validating with, 393
benefts of, 40
checking customized tables, 417
custom rules, adding, 43
deviations, 38
suppressing errors and warnings, 43
BI. See business intelligence (BI)
Bitwise operators, expressions, 113
boolean variable declaration, 111
BoundField controls, 227
BPM (Business Process Modeler), 764, 765
breakpoints, 46, 47
browsers, interactions with Enterprise Portal, 209
build process
creating, 73
executing tests, 563566
business documents. See also workfow, document
class
document hashes, 430
transmitting, 432434
updating, 428430
workfow documents, 262
business intelligence (BI)
analytic content, confguring, 325, 326
components of, 314
customizing solutions, 324
displaying information, 211
external data integration, 338340
implementing, 315324
prebuilt solutions, customizing, 324340
business logic, referencing in classes, 201
Business Overview web part, 211, 361
Business Process Modeler (BPM), 764, 765
business processes, 257, 258. See also process cycles
business unit, 673
button controls, 187, 188
C
CacheLookup values, 441
caching
client vs. server tiers, 471, 474
declarative display method, 439
EntireTable, 474
global variables, 477
indexing, and, 441, 468
number sequencing, 487
records, 467, 468
set-based, enabling, 474
unique index join, 441
calculations, moving to AX 2012, 351
calendars, date dimensions, 330
call stack, 106
calls, grouping into chunks, 445
CALs (client access licenses), 401
capability, 687, 688
CAS (code access security), 140
case, specifying for source code, 67
Case Sensitive comparison option, 59
categories
product, 684
reporting functions, 294
workfows, using in, 280
chart controls
binding to datasets, 306
ED Chart Control, adding, 304
markup elements, 305
chart controls
778
charts
creating for Enterprise Portal, 303
default format, overriding, 310
development tools, AX 2012, 303
EP Chart Control, adding to projects, 304
interactive functions, adding, 308, 309
troubleshooting, 312
class types, 107
classes
batch-executables, creating, 645647
declarations, defning in macros, 535
decorating with attributes, 139
main method, adding, 34
rules, checking for, 43
securing, 392
structuring, 134
upgraded versions, 58
classes and interfaces, 133
class-level patterns, 144146
client access logs, 512
client callbacks, eliminating, 444
client confguration on AOS, 486
Client Performance Options form, 486
client workspace components, 155, 156
client/server performance, optimizing, 438
client-side reporting solutions, 290, 291
cloud, deploying services to, 422
Cloud Hosted Environments, 765
Cloud Powered Support, 767
cloud-based services, using REST, 751
code. See also managed code
call stack, viewing in debugger, 47
customizing forms, with, 197
element types, 13, 14
executing X++ as CIL, 487
permissions, 381
quality, enforcing, 64
recompiling in X++ code editor, 38
set-based operations, transferring into, 459
set-based statements, replacing with, 461
tier-aware, writing, 442
viewing X++ in debugger, 47
code access security (CAS), 140
code access security framework, 392
code samples, downloading, vi
coding patterns, 487500. See also patterns
collection types, 106
columns
displaying default, 164
entity relationship, 52
COM interoperability, 129
combined values, constraining, 694
comments to X++ code
adding, 132
TODO, 38
common language runtime (CLR), 126129
Common menu grouping, 196
Common section, area pages, 159
common type, 108
Compare tool, 5759
Compare APIs, 61
compiling,
X++ code
LINQ queries, 101
concepts, mapping to physical table elements, 697
concrete tables, in inheritance hierarchy, 622
Conditional operators, expressions, 113
conditions, creating for workfows, 280
confguration key element types, 17
confguration keys
references, 401
table hierarchy consistency, 622
using, 399, 400
confguration technology and product masters,
684, 685
confguration time, defning tables, 611
conficts, resolving with OCC, 430
Connect web part, 212
constrained table security policy, 385
constraint-based confguration technology, 684
constructor encapsulation, 144
consuming AX 2012 services, 422, 435
container variable declaration, 111
containers
AxColumn, for controls, 217
converting table buffers into, 445
content pane, workspace component, 156
content section, in HTML, 582, 598
context-sensitive topics, in Help, 586, 587
control elements, user interface, 11
controls
actions, 187
adding, 186
buttons, 187
charting, 303
data binding, 186
Enterprise Portal framework, 215228
input, 192
layout, 189
ManagedHost, 193
overrides, 186
permissions, setting, 379
reports, using in, 297
runtime modifcations, 187
user input, validating, 243
CopyCallerQuery property, 185
cost center operating unit, 673
count aggregate functions, in select statements, 119
coupling, reducing or eliminating, 543
Create Upgrade Project, 30
charts
779
Cross-Reference tool, 62, 63
CRUD operations, 408
cubes
creating, 341351
customizing, 327335
data, exposing to users, 351
deploying, 317323
extending, 335337
feld-level properties, defning, 344
processing, 323
table-level properties, defning, 344
cue element types, 12
cue group element types, 12
cue groups, 195
cues, 157
Cues web part, 212
currency conversions, 333, 346350
CustName, 110
Customer Details form, 152
customers, creating new, 152
Customization Analysis, 766
customizations, deploying, 768
customizing
business intelligence solutions, 324340
defaulting logic for table felds, 419
document services, 417
Help system, 569, 570
custom lookups, 201
custom rules, adding, 43
custom services
adding, 418
artifacts, 408
invoking asynchronously, 430
registering, 411
D
dangerous API exceptions, 43
data
business documents, updating in, 428
dimensions, querying, 696
importing and exporting, 769772
data access logic, using datasets, 213
data binding
controls, 186, 306
feld values, displaying, 227
strategies, 306
data caching, mobile apps and, 753
data connections, supported in SSRS, 299
data contracts
parameters, using in service operations, 410
X++ collection types, using in, 411
Data Dictionary, 21
Data Import/Export Framework (DIXF), 771, 772
data mash-ups, 354
data models
entity relationship, 52
UML, generating, 49
data partitions, 638, 639
data security, 376, 377
data series, 306308
data source view (DSV), 337
data sources
derived, 179, 180
forms, 177
metadata properties, 182
Offce Add-ins, making available to, 202
OLAP, 306
OLTP, 306
saving records in, 181
services, making available, 202
table inheritance and, 178180
data tier architecture, 7
data warehouses, 339
data-aware statements, syntax, 116
database transactions, rolling back, 123
datasets
binding chart controls to, 306
data access logic, defning, 213
dynamic series, 308
initializing with init method, 214
methods, 214, 215
multiseries, 307
single series, 307
temporary record buffers as pointers to, 605608
views, 214
date effectivity, 181
date variable declaration, 111
date-effective framework, 628633
debugging. See also errors; troubleshooting
batch tasks, 658660
breakpoints, 46
Debugger tool, 20
enabling, 45
extensible data security policies, 389
Help system, 598, 599
multiple concurrent updates, 430
security constructs, 394
shortcut keys, 48
user interface elements, 46, 47
web traffc, 757
X++ in batches, with Visual Studio, 660
declarations section, in HTML, 576578
declarative display method caching, 439
decoupling
base and derived classes, 539, 540
events, 544
Default Dimensions, 693
defaulting logic, 419, 420
defaulting logic
780
delegates
declaring, 136
members of a class, adding, 544
subscribing to, 137
delete_from transaction statement, 122
department operating unit, 673
dependencies, batch job tasks, 650653
deploying customizations, 768
derived data sources, 179, 180
derived tables, creating, 621
design, workfow phase, 275
Design node properties, 186
design phase
described, 761
hierarchies, creating, 764
LCS tools and services, 764
design principles of AX 2012, 3
design time, defning tables, 610, 611
designing new transaction detail forms, 169
details forms, 164166
details pages, creating, 231
DetailsFormMaster template, 175
DetailsFormTransaction template, 175
develop phase
customizations, deploying, 768
described, 761
LCS tools and services, 765
development environments
MorphX, 6
Visual Studio, 6
development tools
accessing, 20
layer comparison, 30
mobile apps, 752
wizards, 30
Development Workspace, launching, 20
Dialog template, 175
dictionary API, type-safe refection, 715
digital signatures, adding to models, 734
Dimension Attribute Sets, 693
dimension framework, 692697
Dimension Sets, 693
dimension-based confguration technology, 685
dimensions
concepts, physical table reference mapping, 697
product, 681
querying data, 696
storage, 683, 693, 694
tracking, 683
dirty elements, 25
display menu items, 264
distribution policies, controlling with tokens,
667669
DIXF (Data Import/Export Framework), 771, 772
DLLs. See managed DLLs
document
body section, in HTML, 581
fles, in Help, 572
hashes, 430
head section, in HTML, 578580
services, 412420, 424, 428
sets, 572, 597
documentation and resource element types, 16
documenting XML methods and classes, 132
DropDialog template, 175
DSV (data source view), 337
duties
security roles, assigning to, 381
segregating, 375, 385
duty element types, 14
dynalinks, 178
dynamic role assignment, 376
dynamic series datasets, 308
E
editing Power View reports, 357
editor scripts, 34
EDTs (extended data types)
schemas, restricting, 414
table relations, and, 615617
element types, 918
elements
actions, accessing in the AOT, 26
AOT, 213
browsing, 20
creating, 66
customizing existing, 66
dirty, 25
hierarchies of, 712, 713
IDs, in models, 730, 740
intrinsic functions, referencing with, 708, 709
layers and models, in, 26, 726, 727
life cycle, 66
modifying in the AOT, 24
naming syntax, 22
overwriting, in models, 735
pending, 72
referencing by name, 709
refecting, using APIs, 711724
refreshing, 25
revision history, 71
synchronizing, 25, 69
types, 730
upgrade conficts, 30
versions, 57
workfow, 264
Enterprise Portal
Action pane, 170
delegates
781
AOT elements, 213
architecture, 208
charts, creating, 303
components of, 211
deploying as SharePoint features, 250
described, 207
design considerations, 171
developing applications, 228
exceptions, 244
feature defnitions, 250
framework, described, 8
framework controls, 215228
master pages, 250
metadata, APIs for accessing, 238
navigation paths, 170
page processing, 210
proxies, predefned, 240
search bar, 170
security, role-based, 245
SharePoint, integrating with, 248, 256
SharePoint navigation elements, using, 248
style sheets, 256
top navigation bar, 170
web client, described, 8
web client user experience, 169
web part pages, creating, 252
web parts, 211
workspace components, 170
Enterprise Portal Chart Control. See EP Chart Control
enterprise resource planning (ERP), 153
Enterprise Search, 253, 254
EntireTable caching, 474
entity relationship data model, 52
enumeration types, 106
EP Chart Control
creating, 304
data binding strategies, 306308
described, 289
ERP (enterprise resource planning), 153
error handling, 244
errors. See also debugging; troubleshooting
best practice rules, 42
compiler, 38
Help system, 598, 599
suppressing, 43
event handlers, 264, 545, 546
eventing, 543548
Excel
data mash-ups, 354
Power BI, 359
reports, sharing with users, 360
templates, building, 203
exception data type enumerations, 124
exception handling
best practice, 122
duplicate key, 125
exceptions
dangerous API, 43
throwing, 122
exists method, 147
export/import fle (XPO), 58
exporting
data, 769772
model stores, 726
expressions
lambda, 91
operators, 113
extended data type element types, 10
extended data types, 106, 110
extending transaction detail forms, 169
extensibility patterns
eventing, 543548
extension framework, 539
extensible
classes, 541
data security policies, 385389
extensible data security (XDS) framework, 376, 675
extension framework, 539, 540
extension methods, 90, 97. See also AX 2012 R3
extensions
AX 2012, 300
creating, 539
data processing, 302
disabling, 301
RDL transformations, 301
SSRS, 299
external data integration, 338340
external data sources, data mash-ups in Excel, 354
external web services, consuming from AX 2012, 435
F
FactBox pane, 156
FactBoxes, 164, 165
factory method, 145
false positives, 43
FastTabs
described, 165
organizing felds into, 166
FastTabs TabPage layout control style, 191
feature defnitions, 250
Fiddler web debug proxy, 757
feld lists, 477479
feld-bound controls, 192
feld-level properties, in cubes, 344
felds
aggregating within code, 499
declaring, 134
entity relationship columns, as, 52
felds
782
felds (continued)
hiding, using TabPage, 190
justifying, 483
methods, overriding, 199
organizing into FastTabs, 166
table properties, 616
flters
applying programmatically, 221
custom time periods, adding, 364, 365
projects, using in, 29
tests, creating for, 552
fnancial dimensions, 329, 675
fnd method, 147
Find tool, 54
frstfast hint, using, 498
fexible authentication, 373
foreign key columns, 52
foreign keys
CreateNavigationPropertyMethods, 618620
relations, 617
surrogate, 181
forms
Action panes, 188
ad hoc mode, using on, 482
Auto variables, 200
batch jobs, creating, 648654
business logic, adding calls to, 201
controls, 186, 189, 192194
creating, 174
customizing with code, 197
data sources, 177
dynalinks, 178
element types, 11
hiding felds, 190
input controls, 192
layout controls, 189
lookups, custom, 201, 202
metadata, 176, 182
methods, overriding, 198
navigation items, adding, 195, 196
.NET button, adding, 193
parts, 194, 195
patterns, 174
permissions, setting, 377
queries, 183186
referencing parts, 195
table data information, 712
TabPage, hiding felds using, 190
templates, 175
workfow, enabling in, 284, 285
foundation layer, 5
frameworks
accounting, 698702
address book, integrating, 675
application modules, integrating, 675, 676
batch, 641644, 652654
date-effective, 628633
dimension, 692697
Enterprise Portal, 8, 215228
extensible data security, 675
extension, 539
operations resource, 686692
organization model, 672680
policy, 675
product model, 681686
RunBase, 517, 533
source document, 702705
SysOperation, 516
SysTest, 550553, 566
full update mode, applying for document services,
428
full-text search queries, 633, 634
functions
interactive, adding to charts, 308, 309
refection system, 707711
G
Generic Record Reference, 148
global variables, 47
globalization, 757. See also localization
grids, displaying input controls in, 191
group by sort, in join conditions, 120
group masks in projects, 28
grouping, input controls, 189
guid variable declaration, 111
H
handling exceptions, 122, 125
handshake, secure, 140
hashes, documents, 430
Help documentation set element types, 16
Help system
described, 570576
document fles, 572
errors, 598, 599
Help server, 572, 573
Help viewer, 571
HTML metadata fle, creating, 591, 592
publisher ID, 574
publishing content, 593597
summary page, 574
table of contents, 574, 588590
topics, creating, 573588
troubleshooting, 598, 599
web service, 8, 572, 573
helper threads, 487
flters
783
hierarchies
Business Process Modeler (BPM), creating with,
764
elements, 712, 713
organization model framework, 673, 674
print management, 662, 663
hierarchy designer, extending, 680
history
batch jobs, reviewing, 658
elements, 71
hosting ASP.NET controls, 213
hot swapping assemblies, 87, 88
HTML
Help topics, creating in, 576588
metadata fle, creating, 591, 592
human workfows, defned, 259260
I
IDs
elements, in models, 730
treenode type, 722
importing
data, 769772
model fles, 735, 736
included columns, in indexing, 497
indexing
caching, and, 441, 468
included columns, optimizing with, 497
IndexTabs TabPage layout control style, 190
indicator defnitions, 365
individual task modeling, 488
info parts, 11, 194
Infolog web part, 212
information messages, best practice rules, 42
infrastructure callback, 273
Infrastructure Estimation, 764
inheritance
metadata, 177
RunBase framework, 533
tables, 178180, 621626
InMemory temporary tables, 442, 448, 604609
input controls, 192
Inquiries menu grouping, 196
Inquiries section, area pages, 159
insert method transaction statements, 122
insert_recordset transaction statements, 122
int variable declaration, 111
int64 variable declaration, 111
Integrated Windows Authentication, 373
integration ports
basic, 421
processing messages, sequence of, 435
publishing services, 408
selecting, 433
integration with Microsoft Offce client, 202
interaction patterns, implementing, 232
interactive functions, adding to charts, 308, 309
interface types, 107
inter-form dynalinks, 178
Internet services queries, 299
interoperability
CLR, 126
COM, 129
intra-form dynalinks, 178
intrinsic functions
referencing elements, 708, 709
using, 63
inventory closing, improving speed of, 487
inversion entry column, 52
Issue Search, 767
J
job element types, 13
jobs
model elements, 106
restarting, 465
joined data sources, 178
joins
group by sort, 120
joining tables, 120
operators, 121
set-based operations, and, 455
TempDB temporary tables, using with, 609
Journals section, area pages, 159
K
keys
alternate, columns, 52
confguration, 399, 400
foreign, surrogate, 181
keywords, for select statements, 117, 118
KPI List web part, 361
KPIs
adding, 350, 363
modeling in AOT, 337
L
label editor, 34, 36, 37
label fles
element type, 16
Label Files node, 36
uses for, 242
label fles
784
labels, 34
checking out, 69
creating, 36
Help, referencing from, 584586
reusing, 37
X++, referencing from, 37
lambda expressions, 91
Language-Integrated Query. See LINQ (Language-
Integrated Query)
languages, changing in prebuilt solutions, 331, 332
layers
comparing, 30
element defnitions, 726, 727
fve-layer solution, 46
logical partitions, 5, 6
metadata, 727
models, and, 728
layout controls, 189
LCS (Lifecycle Services), 762768
Ledger Dimensions, 693
Left navigation web part, 212
legal entity organization type, 672
license codes
described, 397, 398
element types, 17
License Sizing Estimator, 764
licensing
customizing, 403
models, 396
life cycle
elements, 66
phases, 761
Lifecycle Services (LCS), 762768
line-item workfows, 265
linked data sources, 178
LINQ (Language-Integrated Query)
anonymous types, creating, 90
components of, 89
constructing, 9194
data access problems, solving, 9598
defned, 76
extension methods, 90
lambda expressions, 91
overhead, limiting with C# compiler, 101
records, managing, 99, 100
var keyword, using to omit variable types, 89
list defnition element types, 16
list pages
alternative to reports, 162
Analyze Data button, adding to, 358
described, 160
designing, 163
displaying default columns, 164
FactBoxes, 164
interaction classes, defning, 230
model-driven, creating, 229
optimizing for performance, 498
performing bulk actions, 164
List web part, 212
ListPage template, 175
literals, supporting upgrade scenarios, 452
local variables, 47
localization, 36, 242, 757
Logical operators, expressions, 113
logical partitions, 5
logs, client access, 512
lookups, customizing, 201, 202, 222
M
macro library, 130, 131
macros
class declarations, defning in, 535
element types, 13
supported directives, 130
using parameters, 131
managed code
debugging, 84
proxies, 85
writing, 7984
managed DLLs, referencing from AX 2012, 77
ManagedHost control, 193
managing state, 279
manifest, models described in, 732
map element types, 10
map record types, 107
master data sources, 177
master pages, 250
master scheduling, improving speed of, 487
maxOf aggregate function, in select statements, 120
measuring performance, 773
member variables, 47
memory heap, 106
menu element types, 11
menu item element types, 11
menu items
labels, in Help topics, 586
operating unit types, creating for, 678
role associations, changing, 403
security properties of, 380
workfows, in, 264, 283
menus, grouping, 196
messages
fow and authentication, 749
sending, unsolicited, 432, 433
metadata
accessing through managed code, 238
associations, in forms, 176
crawling with Enterprise Search, 254
labels
785
defnitions, selecting, 328
derived classes, adding to, 540
element IDs, 740
form data source properties, 182
Help topics, HTML, 578579
Help topics, non-HTML, 591
inheritance, in forms, 177
layers, 727
model store, in, 737739
perspectives, defning, 343
queries, retrieving, 425
WSDL, publishing in, 407420
Method invocations, expressions, 113
method-bound controls, 192
methods
decorating with attributes, 139
extension, 90
initializing a dataset, 214
invoking on objects, 707
main, adding to a class, 34
modifers, 135
object behavior, declaring, 135
overriding with code, 197, 198
pack-unpack, 535538
purposes, adding, 679
QueryBuildDataSource, 184
QueryRunQueryBuildDataSource, 184
RunBase overrides, 516
static new, characteristics of, 533
X++, exposing as a custom service, 408
Microsoft Azure Active Directory Access Control, 747
Microsoft Azure Service Bus adapter, 422
Microsoft Azure Service Bus Relay, 746
Microsoft Dynamics AX
Infolog messages, displaying on webpages, 212
Report Defnition Customization Extension
(RDCE), 300
Reporting Project, 296
Trace Parser, 501. See also tracing
Microsoft Dynamics AX 2012, See AX 2012; AX 2012
R3
Microsoft Dynamics Enterprise Portal confguration,
245. See also Enterprise Portal
Microsoft Dynamics Public confguration, 245
Microsoft Offce client, integrating with, 202205.
See also Offce Add-ins
Microsoft SQL Server Reporting Services (SSRS),
displaying reports, 212
Microsoft XML Core Services (MSXML), 129
migrating customizations, 768
minOf aggregate function, in select statements, 120
mobile apps
architecture variation considerations, 758
AX 2012 service design for, 750
best practices, designing and developing, 753
data storage, 753
described, 747
developer resources, 752, 759
developing, 752757
message fow, 749
offine use, allowing for, 753
on-premise listener, 751
usage, monitoring, 757
user authentication, 749, 754
mobile architecture
components of, 747
developer resources, 752, 759
platform options, 752
variations, 758
mobile clients, using AX 2012 services, 750, 751
model element prefxes, MorphX, 692, 701, 705
model fle, generating from .xpo, 73
model stores
API, 740
defned, 725
deploying, 739
element IDs, 740
exporting, 726
model-driven list pages, 212, 229
modeling
capabilities in the AOT, 326
functional scenarios, 676
models
categories, 733
conficts, resolving with push, 736
creating, 731
described, 728, 729
element IDs, 730, 731
exporting, 733
importing, 735, 736
layers, 726
manifest, describing in, 732
overwriting elements, 735
production, deploying to, 739
publishing, 732736
signing, 734
staging, 737740
test environment, 738
upgrading, 737
modifcations, rolling back, 465
module-specifc navigation links, 212
MorphX
Application Object Tree (AOT), 21
Best Practices tool, 38
classes, upgrading, 58
Compare tool, 57
compiler, 38
Cross-Reference tool, 62
datasets, creating, 213
debugger, 45
MorphX
786
MorphX (continued)
development environment, 6
Find tool, 54
implementing actions, 26
label editor, 34
labels, referencing from X++, 37
model element prefxes, 692, 701, 705
models, creating, 731
personalizing tool behavior, 20
property sheet, 31
Reverse Engineering tool, 48
Table Browser tool, 53
tools and components, 20
Type Hierarchy Browser, 20, 108
Type Hierarchy Context, 20, 108
updating application model elements, 19
user interface control element types, 11
version control, 64, 65
X++ code editor, 32
MSXML (Microsoft XML Core Services), 129
multiseries datasets, 307
N
Name extended data type, 110
Named User license, 396
navigation
items on forms, 195, 196
layer forms, 155, 156, 170
links, 212
panes, 155, 156
SharePoint sites, elements, 248
.NET AJAX. See AJAX
.NET buttons, adding to forms, 193
.NET CIL (common intermediate language), running
X++ as, 142
.NET CLR interoperability statements, 114
number sequence caching, 487
numeric information, displaying on webpages, 212
O
Object creation operators, expressions, 113
object models, UML, 50
object types
reference type, 109
variable declaration, 111
objects
methods, invoking on, 707
Query, 185
QueryRun, 185
OCC (optimistic concurrency control), 430
Offce 365, Power BI, 359
Offce Add-ins, 202205
Offce clients, 8
OLAP database, providing access to, 324
old layered version types, 57
on-corpnet mobile apps, 758
on-premise listener, developing for mobile apps, 751
operate phase
described, 761
LCS tools and services, 767
operating unit organization types, 672, 673, 677
operations
batch servers, running on, 517
downgrading, 454, 456
requirements for defning, 516
operations resource framework, 686692
operators
join, 121
set-based data, manipulating, 447
table hierarchies, 448
optimistic concurrency, 466
optimistic concurrency control (OCC), 430
OptionalRecord, 181
ordered test suites, 562
organization
hierarchies, 673, 674
types, 672, 674
organization model framework, 672680
over-layering, 727
overriding
controls, 186
default chart formats, 310
form methods, 198
P
pack-unpack pattern, 535538
page defnition element types, 16
Page title web part, 212
pages
Enterprise Portal, processing in, 210
pop-up browser window, opening in, 225
SharePoint templates, 249
standard interaction patterns, implementing, 232
parallel activities, in workfows, 265
parallel processing, 433, 435, 488
parameter method, implementing, 144
parameters
AXUpdatePortal utilities, 252
data contract, using in service operations, 410
Parentheses, in expressions, 113
parent pages, passing data to, 226
Parm methods, 34
partial update mode, applying for document
services, 429
partitions, 638, 639
parts, 194, 195. See also web parts
MSXML (Microsoft XML Core Services)
787
passing information
Context data structure, 235
record context interface, 247
patterns
checking for existing records, 494
class-level, 144146, 145
extensibility, 539
for performance, 487500
pack-unpack, 535538
property method, 534
storage, dimensions, 693, 694
table-level, 147, 148
pending elements, viewing, 72
performance
AOS confguration settings, 486
benchmarking, 773
caching, 438, 477
coding patterns, optimizing for, 487500
confguration options, 483487
declarative display method caching, 439
feld justifcation, 483
feld lists, limiting, 479
list pages, optimizing, 498
monitoring tools, 501513
parallel processing, using, 435
table inheritance, 626
transactions, optimizing for, 447
Usage Profler, 764
Periodic menu grouping, 196
Periodic section, area pages, 159
permissions
auto-inference, using, 378
code, 381
defned, 374
forms, setting for, 377
privileges, creating, 380
property values, 381
personas, defned, 352
personName, 112
perspective element types, 10
physical tables, mapping to concepts, 697
platform architecture
application development environments, 6
tiers, 7, 8
platforms, and mobile architecture, 752
policies
context information, 386
extensible data security, 385
policy framework, 675
policy query, 386
polymorphic
associations, 147
queries, 178, 179, 624, 625
pop-up browser windows
opening pages in, 225
parent page, passing data to, 226
Power BI
Offce 365 and, 359
Power View, comparing to, 360
Power View, 353358, 360
pre and post events, 545
prebuilt BI solutions, customizing, 324346
precision design reports, 298
predefned variant confguration technology, 685
pre-event and post-event handlers, 138
prefxes
business area name, as, 22
commonly used, list of, 23
MorphX, model elements, 692, 701, 705
pre-processing data in reports, 299
presentation tier architecture, 8
primary entity, creating and extending, 165
primary table security policy, 386
primitive types, 106
print management
applying, 662
automating tasks, described, 642
hierarchy of, 662, 663
settings, 663669
privilege element types, 14
privileges
creating, 380
defned, 374
security roles, assigning, 381
using, 246
process cycle element types, 14
process cycles, 375
process states
accounting distribution, 704
accounting framework, 700, 701
subledger journalizing, 704
product masters, 681
product variants, 681
product model framework, 681686
production
models, deploying to, 739
reports, 293, 295
profles, associating with users, 323
projects
AOT, maintaining in, 340
creating, 27
customizing, 327335
development tools, 30
flters, 29
generating automatically, 28
group masks, 28
layers, comparing, 30
property sheet, 31
type, specifying, 30
upgrading, 30
projects
788
properties
AOSAuthorization, 391
CopyCallerQuery, 185
Design node, 186
document sets, setting in Help, 597
property method pattern, 534
property sheets, 31
provider callback, 273
proxies
creating new, 240
described, 85
proxy classes, 239
publisher ID, and Help, 574
publishing
AX 2012 services, 421
Help content, 593597
models, 732736
Purchase Order form, 167
purposes
base enum values, creating for, 679
creating custom, 678680
organization types and, 674
Q
quality checks, 67
queries
Axd, guidelines for creating, 416
data, reading through LINQ, 95
data processing extensions, using, 302
dimension data, 696
document services, generating, 412, 416
Enterprise Search, using, 253
flters, applying, 185
forms, 183
Internet services, 299
LINQ, constructing, 9194
metadata, retrieving, 425
Offce Add-ins, making available, 203
polymorphic, 178
reducing execution of, 495
SSAS OLAP, accessing data, 299
T-SQL, accessing data, 299
using, vs. joins, 496
query element types, 11
Query objects, 185
query string parameters, passing record context, 248
QueryBuildDataSource method, 184
QueryFilter API, 635638
QueryRun objects, 185
QueryRunQueryBuildDataSource method, 184
Quick launch web part, 212
Quick links web part, 212
R
RapidStart Services, accessing LCS, 764
RDCE (Microsoft Dynamics AX Report Defnition
Customization Extension), 300
RDL transformations, 301
RDP (report data provider), 299
real variable declaration, 111
record buffer
pointers to datasets, 605608
turning off checks, 451, 456
record context interface, 247
Record type variable declaration, 111
record types, 107
record-based operations
downgrading to, 450
transferring to set-based, 463
records
caching, 467, 468
date-effective framework modes, 632
existing, checking for, 494
form templates and, 175
inserting multiple, 457
joins and, 182
LINQ, managing with, 99, 100
locate, using record context, 247
polymorphic creation of, 179
saving, in form data sources, 181
selecting optimistically, 466
specifying types users can create, 180
updating multiple, 453
RecordViewCache, 475, 476
reference element types, 13
reference layer, 30
reference types, 107
references, dimension concepts and physical tables,
697
referential integrity, Unit of Work, 626
refection
APIs, 711724
described, 707
methods on objects, invoking, 707
Reverse Engineering tool, 707
system functions, 707711
tables, 714
views, 714
refreshing elements, 25
Relational operators, expressions, 113
relationships between tables, 615620
released products, 683
rendering extensions, disabling, 301
Report Builder, 366
report data provider (RDP), 299
Report model, in Visual Studio, 297
Report web part, 212
properties
789
reporting framework, troubleshooting, 311, 312
reports
AX 2012 development tools, 296
categorizing based on roles, 294
client-side solutions, 290
controls, using, 297
creating, 295
datasets, 294, 298
designs, 294, 297, 298
development roles, 294
display content, controlling, 298
edits by users, 357
element types, 12
execution sequences, 300, 302
extensions, 8
layout design, 297
Microsoft Dynamics AX Reporting Project
template, 296
Model Editor, using, 297
Power View, 354, 357
pre-processing data, 299
Report Builder, using, 366
server-side solutions, 292
solutions, planning, 293
SSRS elements, 296
SSRS extensions, 299
static, creating, 302
troubleshooting, 311, 312
Visual Studio tools, using, 366369
Reports menu grouping, 196
Reports section, area pages, 159
resource element types, 16
resources, identifying for activities, 690
RESTful services, 751
retail channel operating unit, 673
Reverse Engineering tool
described, 48
entity relationship data model, 52
UML models, generating, 49, 50
revision history, 71
RFP Responses, 764
Role Centers
analytic content, displaying, 351369
OLAP reports, 326
pages, 156, 157
reports, adding, 355, 356
user profles, 323
role-based security, 14, 246
roles
access control, based on, 373
assigning to users, 384
categories of, 352
element types, 14
menu item associations, changing, 403
privileges, assigning, 381
reporting needs, based on, 294
security, assigning to users, 376
security artifact associations, changing, 403
role-tailored design, 153
rolling back modifcations, 465
root data sources, 177
root tables, creating, 621
round trips, reducing, 438441, 445, 447, 458, 477
RowCount method, 121
rows, deleting multiple, 455
rules, segregating duties, 385. See also best practices,
rules
RunBase
inheritance, 533
round trips, handling, 440
SysOperation, comparing to, 517, 518
RunOn, instantiating objects, 442
run time, and temporary tables, 611, 612
runtime modifcations, 187
S
Sales Order form, 167
scenarios, modeling, 676
search bar
Enterprise Portal, in, 170
workspace component, 155
searching
Enterprise Search, using, 253, 254
Find tool, using, 54
full-text support, 633, 634
Help viewer, 571
Issue Search, 767
ranges, specifying, 56
Windows Search Service, 573
securing APIs, 392
security
APIs, 392
authorization, role-based access, 373
CAL role mapping, 402
coding, 390394
controls, permissions for, 379
data policies, assigning, 376
debugging, 394396
duties, assigning to roles, 381
Enterprise Portal, 245
exposing web controls, 246
forms, setting permissions for, 377
hash parameters, using, 248
hierarchy and user types, 402
policy concepts, 385
privileges, 380, 381
role-based, 246
roles, 375, 376
security
790
security (continued)
server methods, setting permissions for, 379
service operations, and, 420
security artifacts
developing, 377381
menu options, 395
role associations, changing, 403
validating, 384
security framework, 372376
security policy element types, 14
select forUpdate transaction statements, 122
select query, ordering and grouping, 119
select statements
aggregate functions, 120
joining tables, 120
keyword options, 117, 118
syntax, 117
separation of concerns and processes, 3
serializing with the pack and unpack methods, 146
Server Confguration form, 484
server methods, setting permissions for, 379
server-side reporting solutions, 292
service contracts
custom services, in, 409, 410
document services, in, 412
service element types, 13
service implementation
custom services, 409
document services, 413
service contracts, 409
service operations, and security, 420
services
AX 2012, consuming, 422
making available, 202
sessions, disposal and caching, 234
set-based operations
caching, 474
code, transferring into, 459
downgrading, 451, 452, 454
InMemory temporary tables, and, 448
joins, using, 455
manipulating data, 447
record-based, downgrading to, 450
table hierarchies, and, 448
Setup menu grouping, 196
Setup section, area pages, 159
SGOC (SysGlobalObjectCache), 477
shared steps, 559561
SharePoint
developing web part pages and lists, 228
sites, 249
SQL Server Power View, and, 355
themes, integrating with Enterprise Portal, 256
Shift operators, expressions, 113
shortcut keys
debugging, 48
X++ code editor, 33
Show Differences Only comparison option, 59
Show Line Numbers comparison option, 59
signing models, 734
SimpleList template, 175
SimpleListDetails template, 175
single series datasets, 307
site navigation, 248
solution architecture, fve-layer, 46
source code casing, executing, 67
Source Code Titlecase Update tool, 67, 111
source document framework, 702705
SQL Administration form, 483
SQL Server Analysis Services. See SSAS (SQL Server
Analysis Services)
SQL Server Power View. See Power View
SQL Server Reporting Services. See SSRS (SQL Server
Reporting Services)
SSAS (SQL Server Analysis Services), 4, 315, 317,
335, 336
described, 8
OLAP queries, 299
SSRS (SQL Server Reporting Services)
components of, 296
data connections, supported, 299
described, 4
report element types, 12
reporting extensions, 8, 299
reports, displaying, 212
standard layered version types, 57
Standard TabPage layout control style, 190
state model, 279
statements, 114116
states, managing, 279
static fle element types, 16
static RDL reports, 302
static schema, 326
storage, dimensions, 683, 693, 694
str variable declaration, 111
string, as Name extended data type, 110
String concatenation, expressions, 113
string literals, expressing, 112
strong names, 76, 77, 734
style sheets, 256
subledger journalizing process, 704
subnodes, changing the order of, 24
subworkfows, 264
sum aggregate function, in select statements, 120
summary page, in Help, 574
suppressing
errors and warnings, 43
whitespace, during fle comparison, 59
surrogate keys, 181, 612614
security artifacts
791
synchronizing elements
sequence of operations, 69
viewing the log, 70
SysAnyType, 108
SysGlobalCache, 477
SysGlobalObjectCache (SGOC), 477
SysObsoleteAttribute, 139
SysOperation
attributes, 517
classes, 516
execution modes, 489, 490
RunBase, comparing to, 440, 517, 518
System Diagnostic Service, 767
system documentation element types, 16
system navigation, role-tailored, 153
system services, 407, 408, 425
system workfows, defned, 259
SysTest framework, 550553, 566
T
Table Browser tool, 53
table collection element types, 11
table hierarchies, and set-based operations, 448
table of contents, in Help, 574, 588590, 593599
table permissions framework, 377, 390
table-level patterns, 147, 148
table-level properties, in cubes, 344
TableOfContents template, 175
tables
alternate keys, 614
Ax<Table> classes, accessing with, 415
behavior, specifying in hierarchy, 622
buffers, 445
caching contents, 441, 467, 468
confguration time, 611
customizing, 417
data consistency, and run-time support, 631
data retrieval, 630, 631
data storage, mapping to, 623
date-effective entities, relational modeling
of, 628630
defaulting logic for felds, 419, 420
design time, 610, 611
EDT relations, 615617
feld labels, adding to Help topics, 585
feld properties, 616
feld states, tracking, 420
foreign keys, 617, 618
index clause, 118
inheritance, 178180, 621626
InMemory, 442, 604608
joins, 609, 613, 618, 625, 626, 635, 636
keys, 612614
model store, 725
multiple records, inserting, 449, 457
physical, mapping to concepts, 697
record types, 107
records, inserting and modifying, 121
references, custom lookups, 201
refection, 714
relationships between, 615620
rows, manipulating, 465
run time, 611, 612
surrogate keys, 612614
TempDB, 609612
TempDB vs. inMemory, 443
temporary, 442, 443, 448, 449, 604612
type-safe method, and, 109
unique index join cache, 473
valid time state, using, 383
TabPage layout controls, 190
tasks
batch, debugging, 658660
batch jobs, and, 650653
compiler, 38
workfow element, 264
Team Foundation Build, 563566
TempDB temporary tables, 443, 444, 609612
templates
adding for users, 205
Excel, building for, 203
form patterns, 174
Help topics, 576
Word, building for, 204
temporary tables
creating, 610, 611
InMemory, 442, 604609
multiple records, inserting, 449
set-based operations and inMemory, 448
TempDB, 609612
TempDB vs. inMemory, 443
test cases, developing in phases, 562
Test Data Transfer Tool, 769, 770, 772, 773
test environments, models, 738, 739
Test project type, 30
test suites, using for long scenarios, 562
testing
ALM solution, 556
ATDD (acceptance test driven development), 557,
558, 566
attributes, creating for tests, 552
build processes, executing in, 563566
environments, described, 566, 567
evolutionary case development, 562
flters, creating, 552
integration, 552555
ordered test suites, 562
predefned attributes, 550552
testing
792
testing (continued)
shared steps, 559561
Team Foundation Build, 563566
Visual Studio 2010 tools, 556562
TFS version control system, 65
themes, integrating with SharePoint, 256
third-party
assemblies, 7679
clients, 8
libraries, mobile app developer resources, 752
tiers
Business Intelligence solution, 314
caching, client vs. server, 471
client vs. server, 538
instantiating objects using RunOn, 442
time periods, 365
TimeOfDay variable declaration, 111
TODO comments, 38
tokens, print management, 667669
Toolbar web part, 213
toolbars
AxToolbar control, using, 224
displaying on webpages, 213
topics, in Help
context-sensitivity, 586, 587
described, 573, 574
labels, adding, 584586
templates, 576
top navigation bar, in Enterprise Portal, 170
top picking, 489
Trace Parser, 501, 502. See also tracing
tracing
analyzing results, 506
code instrumentation, using, 505
database activity, monitoring, 510
importing, 506
starting, 502, 503
Tracking Cockpit options, 503
troubleshooting, 509
Visual Studio Profler, 512
Windows Performance Monitor, using, 504
Tracking Cockpit options, 503
transaction details forms
described, 167
designing new, 169
extending existing, 169
header view, 168
line view, 168
Purchase Order, 167
toggling between views, 168
transaction statements, 122
transactions, optimizing for performance, 447
Transact-SQL (T-SQL) queries, 299
translations, 331, 332
transmitting business documents, 432434
treenodes, 718723
triggers, implementing for message transmission,
432
troubleshooting. See also debugging; errors
Help system, 598, 599
reporting framework, 311, 312
reports, 312
Server Process ID (SPID), using, 511
systems, using System Diagnostic Service, 767
tracing issues, 509
usage issues, 764
trusted code, defning, 140
T-SQL (Transact-SQL) queries, 299
ttsAbort transaction statements, 121
ttsBegin transaction statements, 121
ttsCommit transaction statements, 121
type hierarchies, 107, 621
Type Hierarchy Browser tool, 20, 108
Type Hierarchy Context tool, 20, 108
U
unbound controls, 192
under-layering, 727
Unifed work list web part, 213
unique index join cache, 441, 473
Unit of Work, 181, 626628
unit testing, 550553
Update Installer for Microsoft Dynamics AX 2012 R3,
767
update_recordset transaction statements, 122
updating
business documents, 428430
Help topics, 587, 588
Upgrade Analysis, 766
upgraded class versions, 58
upgrading projects, 30, 766
URLs, Power View parameters, 356
Usage Profler, 764
user authentication
mobile apps, 749, 754
SSL, setting up, 754
user context information, 47
User control web part, 213
user experience
Enterprise Portal, 169
mobile apps, and, 754
navigation layer, 154
role-tailored design, 153
simplifying with FactBoxes, 166
work layer, 154
user input, validators, 243
user interface
control element types, MorphX, 11
TFS version control system
793
debugger elements, 46
default, creating from defnitions, 516
labels, referencing from Help, 584586
wizard-driven, 326
user templates, adding, 205
user types, and security hierarchy, 402
user-defned class types, 107
users
access to OLAP database, providing, 324
assigning roles to, 384
CAL role mapping, 402
creating, 384
cube data, exposing data to, 351
Power View reports, editing, 357
profles, associating with, 323
provisioning, 323
tracking activities, 512
USR layer, 726
utcDateTime variable declaration, 111
V
valid time state tables, 383
validating
logic, with Best Practices tool, 393
security artifacts, 384
validation code elements, 418, 419
validation logic, 418
value stream operating unit, 673
value types, 106
values
combinations, constraining, 694
expressions, 113
Ledger Dimensions, creating, 695
var keyword, 89
variables
Auto, form-specifc, 200
declarations, 111
declared as reference types, 107
expressions, 113
grouping in debugger, 47
reference, declared as record types, 107
viewing in debugger, 47
VendName, 110
version control systems
build process, 73
code quality, enforcing, 64
common tasks, 68
element life cycle, 66
history of elements, showing, 71
integrating AX 2012, 74
isolated development, 64
labels, working with, 69
MorphX VCS, 65
pending elements, viewing, 72
quality checks, 67
revisions, comparing, 72
source code casing, 67
synchronization log, viewing, 70
synchronizing elements, 69
TFS, 65
Visual SourceSafe, 65
Version Control tool, 64
VerticalTabs TabPage layout control style, 190
view element types, 10
view record types, 107
views
dimensions, creating, 677
refection, 714
ViewState, 241
Visio models, generating, 48
Visual SourceSafe 6.0 version control system, 65
Visual Studio
details pages, creating, 231
EP Chart Control markup, 305
Microsoft Dynamics AX Reporting Project
template, 296
Report model, 297
reports, creating with, 366369
Team Foundation Build, 563566
test tools, 556562
X++, debugging in a batch, 660
Visual Studio Profler, 512
W
weak type systems, avoiding, 108
web apps for mobile devices, 758
web client element types, 1516
web elements, securing, 246
web menu items, 264
web parts
Action pane, 211
business intelligence information, 211
Business Overview, 361
integrating into webpages, 211
KPI List, 361
linking information, 212
page framework, using from SharePoint, 208
Page Viewer, 356, 357
pages, 251253
Power View, exposing reports, 355357
SharePoint sites, 249
web service calls, analyzing, 757
web services
consuming from AX 2012, 435
debugging traffc, 757
Web Services Description Language (WSDL), 407
Web Services Description Language (WSDL)
794
web traffc, debugging, 757
Web.confg fles, adding publishers, 594596
webpages
alert notifcations, 213
ASP.NET, creating with AJAX, 233
ASP.NET controls, hosting, 213
Infolog messages, displaying, 212
page-specifc navigation, 212
toolbars, displaying, 213
web parts, integrating, 211
workfow actions, displaying, 213
WF (Windows Workfow Foundation), 261
Windows client, 8
Windows Performance Monitor, using to trace, 504
Windows Search Service, 573, 598
Windows Workfow Foundation (WF), 261
WindowMode settings, 232
Word, building templates, 204
work layer forms, 154
workfow
action menu items, 264
actions, displaying on webpages, 213
activating, 283287
architecture, explained, 268
artifacts, 275277
automating, 276
categories, 262, 280
conditions, creating, 280
display menu items, 264
document class, 262, 280, 282
editor, 267
elements, 12, 264
event handlers, 264
forms, enabling in, 284, 285
implementing, 276
infrastructure, 258260, 276
instances, 268
key concepts, 262268
life cycle phases, 275
line-item, 265
menu items, 264, 283
provider model, 266
queues, assigning to, 265
runtime, 269273
states, managing, 279
types, 258259, 263
work items, 268
workfow runtime
acknowledgment messages, 272
activation messages, processing, 270
API, to expose functionality, 269
application code, invoking, 269
components, 269
events, 272
instance storage, 269
interaction patterns, 272, 274
logical approvals, 272
message queue, 269
task elements, 272
tracking information, 269
workspace components. See client workspace
components
WSDL (Web Services Description Language)
described, 407
proxy generation, using for, 422
X
X++
APIs, refecting on elements, 711724
collections, using in data contracts, 411
datasets, 214
delegates, adding, 544
events, 543
expression operators, 113
interoperability, allowing, 125
jobs, 106
macro capabilities, 130
methods, exposing as a custom service, 408
primitive types, converting from and to CRL
objects, 128
refection, system functions, 707711
statements, 114
syntax, 110, 111
variable declarations, 111
X++ code
class-level patterns, 144
compiling and running as .NET CIL, 142
design and implementation patterns, 143
executing as CIL, 487
X++ code editor, 20
editor scripts, 34
opening, 32
recompiling, 38
shortcut keys, 33
XDS (extensible data security) framework
creating policies, 385
described, 376
XML
documentation, 132, 133
messages, sending asynchronously, 431
serialization, implementing for data objects, 414
XPO (export/import fle), 58
web traffc, debugging

You might also like