44,39 €
Dynamics 365 for Operations is the ERP element of Microsoft’s new Dynamics 365 Enterprise Edition. Operations delivers the infrastructure to allow businesses to achieve growth and make better decisions using scalable and contemporary ERP system tools.
This book provides a collection of “recipes” to instruct you on how to create—and extend—a real-world solution using Operations. All key aspects of the new release are covered, and insights into the development language, structure, and tools are discussed in detail.
New concepts and patterns that are pivotal to elegant solution designs are introduced and explained, and readers will learn how to extend various aspects of the system to enhance both the usability and capabilities of Operations. Together, this gives the reader important context regarding the new concepts and the confidence to reuse in their own solution designs.
This “cookbook” provides the ingredients and methods needed to maximize the efficiency of your business management using the latest in ERP software—Dynamics 365 for Operations.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 458
Veröffentlichungsjahr: 2017
BIRMINGHAM - MUMBAI
Author
Simon Buxton
Copy Editor
Zainab Bootwala
Reviewers
Simon Klingler
Martin Winkler
Project Coordinator
Vaidehi Sawant
Commissioning Editor
Aaron Lazar
Proofreader
Safis Editing
Acquisition Editor
Denim Pinto
Indexer
Tejal Daruwale Soni
Content Development Editor
Siddhi Chavan
Production Coordinator
Deepika Naik
Technical Editor
Dhiraj Chandanshive
Simon Buxton has worked with Dynamics 365 for Operations since its earliest incarnations, starting out as a consultant and developer in early 1999 when Dynamics 365 for Operations was known as Damgaard Axapta 1.5. He quickly became a team leader at Columbus IT Partners and carried out one of the first Axapta implementations in the UK before joining a new reseller, Sense Enterprise Solutions, as its technical director. Sense Enterprise Solutions enjoyed a global reach through the AxPact alliance, where Simon was placed as AxPact's Technical Lead.
Simon played a major role in growing the company into a successful Microsoft partner and was the Technical Lead on a number of highly challenging technical projects around the world, ranging from the UK, to Bahrain, to the USA. These projects include developing solutions for third-party logistics, multichannel retail, and eventually developing an animal feed vertical, as well as integrating Dynamics 365 for Operations into production control systems, government gateways, and e-commerce solutions, among others. Now, working with Binary Consultants, he was part of a team that implemented the first Dynamics 365 for Operations implementation with support from Microsoft as part of the Community Technical Preview program (CTP). The knowledge gained as part of this process led to the creation of this book.
Simon has also worked on Mastering Microsoft Dynamics AX 2012 R3 Programming and Microsoft Dynamics AX 2012 R2 Administration Cookbook.
Simon Klingler has been working with Microsoft Dynamics 365 for Operations and its predecessor products (Microsoft Dynamics AX, Axapta) since 2001. He gained experience as a developer, consultant, presales consultant, product manager, and solution architect. He has successfully implemented ERP solutions in national and international projects from 3 to 1000+ users. He was a product manager for several add-ons for Microsoft Dynamics ERP solutions.
He started working on the latest release in its very early days and regularly exchanged experiences, feedbacks, and lessons learned with the author of this book. Currently, he is working on several cloud and local business data implementation projects as a solution architect.
In 2013, Simon co-founded Semantax, a company providing products and expert consulting services based on Microsoft Dynamics AX. In December 2014, he co-founded the Solutions Factory (www.sf-ax.com), a company delivering full-scale Microsoft Dynamics ERP implementations, in stable and long-lasting partnerships with its customers. He is especially proud of the team that was formed in the course of the last years: the right people with the right attitude, a great mix of experienced advisers and developers, as well as young potentials. The team members motivate each other and unfailingly impress the clients.
Martin Winkler has over 13 years of experience with Microsoft Dynamics 365 for Operations and its previous releases.
After receiving his Master's degree in Mathematical Computer Sciences at Vienna University of Technology, he gained experience as an IT Consultant at Capgemini and later, as a BI Consultant at an Austrian consulting company specializing in CFO-targeted services.
In 2003, Martin joined Solutions Factory, a newly-founded Austrian company that specialized in Microsoft Dynamics 365 for Operations services. Starting as a developer and head of IT, he later became the head of development of up to 10 developers. From 2007 onwards, he additionally built up a team of performance experts. In 2008, the company (then FWI) became the largest Microsoft Dynamics 365 for Operations partner in Austria. While staying in development, he mostly worked as Technical Lead Consultant for several corporate customers with global implementations and with up to 1000 users. He also carried out numerous projects in the areas of performance and Microsoft BI for these customers.
Together with two long-term colleagues, he founded his own company in 2013, Semantax, providing products and expert consulting services based on Microsoft Dynamics 365 for Operations. In 2014, the experts of Semantax teamed up with two further long-term colleagues with vast know-how in industry processes and corporate ERP projects to relaunch the Solutions Factory.
Solutions Factory (www.sf-ax.com) is dedicated to shaping customer processes and to mapping them to Dynamics 365 for Operations in an efficient and optimal way. It follows its vision of contributing to the high competitive capability of European manufacturing companies. During the review of this book, the team was supporting five large customers with their Microsoft Dynamics 365 for Operations implementations.
Over the last decade, Martin has met the author of the book at several technical conferences on Microsoft Dynamics 365 for Operations. He was impressed not only with the author's in-depth technical knowledge, but also with his understanding of the business and process sides of the ERP branch. He enjoyed reviewing the previous books by the same author and was honored to support the author with this book as well. He hopes the readers will enjoy the read as much as he did.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.comand as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1786467135.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Starting a New Project
Introduction
Creating the Visual Studio Team Services project
Getting ready
How to do it...
How it works...
See also...
Connecting Visual Studio to Visual Studio Team Services
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a new Model and Packages
Getting ready
How to do it...
How it works...
There's more...
Prefixes and naming conventions
Configuring project and build options
Getting ready
How to do it...
Dynamics 365 for Operations' options
The project-specific parameters
There's more...
Creating a Label file
Getting ready
How to do it...
How it works...
There's more...
Data Structures
Introduction
Creating enumerated types
Getting ready
How to do it...
How it works...
There's more...
Using Enums for comparison and status
Extensibility in Base Enums
Creating extended data types
Getting ready
How to do it...
How it works...
There's more...
Creating setup tables
Getting ready
How to do it...
How it works...
Creating a parameter table
How to do it...
There's more...
Copying and pasting methods to save time
Optimistic concurrency and selectForUpdate
See also
Creating main data tables
Getting ready
How to do it...
How it works...
There's more...
More on indexes
See also
Creating order header tables
Getting ready
How to do it...
How it works...
There's more...
Creating order line tables
How to do it...
How it works...
See also
Creating the User Interface
Introduction
Creating the menu structure
Getting ready
How to do it...
How it works...
Creating a parameter form
How to do it...
How it works...
There's more...
See also
Creating menu items
Getting ready
How to do it...
How it works...
Creating setup forms
How to do it...
How it works...
There's more...
Creating details master (main table) forms
How to do it...
How it works...
Creating a details transaction (order entry) form
How to do it...
How it works...
Creating form parts
Getting ready
How to do it...
How it works...
Create tiles with counters for the workspace
Getting ready
How to do it...
How it works...
There's more...
Creating a workspace
How to do it...
How it works...
There's more...
Application Extensibility, Form Code-Behind, and Frameworks
Introduction
Creating a handler class using the Application Extension factory
Getting ready
How to do it...
How it works...
There's more...
See also...
Hooking up a number sequence
Getting ready
How to do it...
How it works...
Number sequence set up
Hooking up the number sequence
There's more...
Creating a create dialog for details transaction forms
Getting ready
How to do it...
How it works...
Creating a SysOperation process
How to do it...
How it works...
There's more...
Executing code using the batch framework
Calling a process from a form
Using the data contract to make changes to the dialog
Adding an interface to the SysOperation framework
Getting ready
How to do it...
How it works...
Business Intelligence
Introduction
Creating aggregate dimensions
Getting ready
How to do it...
How it works...
See also
Creating aggregate measures
Getting ready
How to do it...
How it works...
Creating aggregate data entities
Getting ready
How to do it...
How it works...
Creating and using key performance indicators
Getting ready
How to do it...
How it works...
There's more...
Security
Introduction
Creating privileges
Getting ready
How to do it...
How it works...
There's more...
Impact on licensing
See also
Creating duties
How to do it...
How it works...
There's more...
Creating security roles
How to do it...
How it works...
See also...
Creating policies
How to do it...
How it works...
There's more...
See also...
Leveraging Extensibility
Introduction
Extending standard tables without customization footprint
Getting ready
How to do it...
How it works...
There's more...
Creating data-event handler methods
Getting ready
How to do it...
How it works...
There's more...
How to customize a document layout without an over-layer
How to do it...
How it works...
There more...
Creating event handler methods
Getting ready
How to do it...
How it works...
Extending standard forms without customization footprint
Getting ready
How to do it...
How it works...
There's more...
Using a form event handler to replace a lookup
Getting ready
How to do it...
How it works...
Creating your own query functions
How to do it...
How it works...
Data Management, OData, and Office
Introduction
Creating a data entity
Getting ready
How to do it...
How it works...
There's more...
See also
Extending standard data entities
Getting ready
How to do it...
How it works...
There's more...
Importing data through Data Import/Export Framework
Getting ready
How to do it...
How it works...
See also
Reading, writing, and updating data through OData
Getting ready
How to do it...
How it works...
See also
Consuming and Exposing Services
Introduction
Creating a service
Getting ready
How to do it...
How it works...
Consuming a Dynamics 365 for Operations SOAP service
Getting ready
How to do it...
How it works...
See also
Consuming a Dynamics 365 for Operations JSON service
Getting ready
How to do it...
How it works...
There's more...
See also...
Consuming an external service within Dynamics 365 for Operations
Getting ready
How to do it...
How it works...
There's more...
Extensibility Through Metadata and Data Date-Effectiveness
Introduction
Using metadata for data access
Getting ready...
How to do it...
How it works...
Using Interfaces for extensibility through metadata
Getting ready...
How to do it...
How it works...
Making data date-effective
Getting ready...
How to do it...
How it works...
There's more...
Unit Testing
Introduction
Creating a Form Adaptor project
Getting ready
How to do it...
How it works...
Creating a Unit Test project
Getting ready
How to do it...
How it works...
Creating a Unit Test case for code
Getting ready
How to do it...
How it works...
Creating a test case from a task recording
Getting ready
How to do it...
How it works...
Automated Build Management
Introduction
Creating a Team Services Build Agent Queue
Getting ready
How to do it...
How it works...
Setting up a build server
Getting ready
How to do it...
How it works...
There's more...
See also
Managing build operations
Getting ready
How to do it...
How it works...
Releasing a build to User Acceptance Testing
Getting ready
How to do it...
How it works...
Servicing Your Environment
Introduction
Applying metadata fixes
Getting ready
How to do it...
How it works...
There's more...
See also
Applying binary updates
Getting ready
How to do it...
How it works...
See also
Servicing the build server
Getting ready
How to do it...
How it works...
Servicing the Sandbox - Standard Acceptance Test environment
Getting ready
How to do it...
How it works...
There's more...
Servicing production
See also
Workflow Development
Introduction
Creating a workflow type
Getting ready
How to do it...
How it works...
See also...
Creating a workflow approval
Getting ready
How to do it...
How it works...
Creating a manual workflow task
Getting ready
How to do it...
How it works...
Hooking up a workflow to the user interface
Getting ready
How to do it...
How it works...
Creating a sample workflow design
Getting ready
How to do it...
How it works...
State Machines
Introduction
Creating a state machine
Getting ready
How to do it...
How it works...
Creating a state machine handler class
Getting ready
How to do it...
How it works...
There's more...
Using menu items to control a state machine
Getting ready
How to do it...
How it works...
Hooking up the state machine to a workflow
Getting ready
How to do it...
How it works...
There's more...
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2017
Production reference: 1120517
ISBN 978-1-78646-713-3
www.packtpub.com
Microsoft Dynamics 365 for Operations is an ERP solution for complex single-site, multi-site, and multi-language global enterprises. This flexible and agile solution provides advanced functionality for manufacturing, retail, public sector, and service sector industries. Not only does this solution provide a strong set of built-in functionality, it also provides an industry-leading integrated development environment, allowing an organization to provide even higher levels of fit. This book should be in the tool belt of any software engineer who works with or is about to embark on a career with Dynamics 365 for Operations.
This provides software engineers and those involved in developing solutions within Dynamics 365 for Operations with a toolkit of practical recipes for common development tasks, with important background information to provide deep insight to allow the recipes to be adapted and extended for your own use. Even for experienced software engineers, this book will provide a good source of reference for efficient software development.
For those moving from Microsoft Dynamics AX 2012, we cover critical changes in how software is adapted, how to use the new extensibility features of Microsoft Dynamics 365 for Operations, and tips on how to use them in a practical way. We also cover the fundamental changes in the physical structure of the application metadata, the application development life cycle, and how we fit in with the new cloud-first development paradigm with Lifecycle services and Visual Studio Team Services. Integration will be a concern to AX developers, and we cover this in detail with working examples of code that can be adapted to your own needs.
In order to facilitate this, the book follows the development of a solution as a means to explain the design and development of tables, classes, forms, BI, menu structures, workflow, and security. We begin at the start of the development process by setting up a Visual Studio Team Services project, integrating Lifecycle services, and explaining new concepts such as Packages, Models, Projects, and what happened to layers. The book progresses with chapters focused on creating the solution in a practical order, but it is written in such a way that each recipe can be used in isolation as a pattern to follow.
The sample solution was designed and developed as the book was written and is available for download. There is a sample Operations project, OData C# integration test project, and a C# project for using web services supplied by Microsoft Dynamics 365 for Operations.
With this comprehensive collection of recipes, you will be armed with the knowledge and insight you need to develop well-designed solutions that will help your organization to get the most value from this comprehensive solution for both the current and the upcoming releases of Microsoft Dynamics 365 for Operations.
Chapter 1, Starting a New Project, covers setting up a new Visual Studio Team Service project, integrating with Lifecycle Services, and creating a Microsoft Dynamics 365 for Operations package and model.
Chapter 2, Data Structures, contains common recipes for creating data structure elements such as tables, enumerated data types, and extended data types. The recipes are written to patterns, guiding you through the steps you would take when creating the types of table used in Microsoft Dynamics 365 for Operations application development.
Chapter 3, Creating the User Interface, explains how to create the user interface elements such as menus, forms, form parts, tiles, and workspaces. This chapter includes recipes for each of the main types of user interfaces used when creating or extending Dynamics 365 for Operations with practical guidance and tips on how to do this efficiently.
Chapter 4, Application Extensibility, Form Code-Behind, and Frameworks, helps us step into writing the business logic behind our user interface and understand how to write code designed to be extensible, allowing other parties to extend our code with the over-layering that can version-lock customers. We also cover the SysOperation framework, using which processes are developed, and we'll see how to add a user interface to them.
Chapter 5, Business Intelligence, covers the creation of a business intelligence project that can be used to create powerful dashboards in Microsoft Power BI. The recipes in this chapter cover the creation of aggregate dimensions, measures, data entities, and KPIs in a real-world context. This is done using the sample vehicle management application that is created through the course of this book.
Chapter 6, Security, explains the security model design in Microsoft Dynamics 365 for Operations and provides recipes for the creation of the elements used in security. The recipes augment the standard documentation in order to provide real-world examples on how to create and model Dynamics 365 for Operations security.
Chapter 7, Leveraging Extensibility, shows how extensibility can be said to be one of the biggest changes in Dynamics 365 for Operations. This chapter pays special attention to the key aspects of how to use extend the standard application without becoming version locked in a customized solution.
Chapter 8, Data Entity Extensibility, OData, and Office, covers the many ways in which we integrate with the world outside of Dynamics 365 for Operations. This covers how to create and extend data entities, work with Microsoft Office, and use OData to read, write, and update data in Dynamic 365 for Operations from a C# project.
Chapter 9, Consuming and Exposing Services, provides recipes for creating a service from within Dynamics 365 for Operations, consuming external services, and also on consuming Dynamics 365 for Operations services in C# using SOAP and JSON. All this is covered using practical examples that should easily translate into your own specific requirements.
Chapter 10, Extensibility through Metadata and Data Date-Effectiveness, pushes extensibility even further by showing how we can use metadata stored in data to put more power in the hands of system administrators. We also cover how to make our tables date effective.
Chapter 11, Unit Testing, provides recipes to show how to create unit tests and how they are used with the application life cycle. This chapter covers an insight into test-driven development, automated unit testing on the build server, and how to create and use the task recorder to create test cases.
Chapter 12 , Automated Build Management, helps us move more into application life cycle management where this chapter provides recipes for setting up and using a build server.
Chapter 13, Servicing Your Environment, provides practical recipes that are intended to augment the standard documentation provided by Microsoft in order to provide real-world examples on how we service our Dynamics 365 for Operations environments.
Chapter 14, Workflow, covers the development of workflow approvals and tasks in Dynamics 365 for Operations. The recipes are given context by continuing to work with the sample application that is created through the course of this book, effectively explaining state management, which is easily misunderstood.
Chapter 15, State Machines, covers state machines, which is another new feature in Dynamics 365 for Operations. This chapter covers all key areas of this new feature, explaining when and how to use this feature appropriately.
In order to gain access to Microsoft Dynamics 365 for Operations, you need to be either a Microsoft partner or customer. To sign up for a gain access as a partner, you can refer to Lifecycle Services for Dynamics 365 for Operations partners at https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/lifecycle-services/getting-started-lcs.
To sign up for a subscription as a customer, refer to Lifecycle Services for Dynamics 365 for Operations partners at https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/lifecycle-services/getting-started-lcs.
You will need to download or deploy a Dynamics 365 for Operations development VM in Azure. To run the VM locally, you will need at least 100 GB free space available and a minimum of 12 GB free memory, ideally 24 GB. It will run on as little as 8 GB of assigned memory, but the performance will suffer as a result.
The official system requirements are as follows:
System requirements
(
https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/get-started/system-requirements
)
Development system requirements
(
https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/dev-tools/development-system-requirements
)
If you are a software developer new to Dynamics 365 for Operations programming or an experienced software engineer migrating from its predecessor, Dynamics AX, this book is an ideal tutorial to help you avoid the common pitfalls and make the most of this advanced technology. This book is also useful if you are a solution architect or technical consultant, as it provides a deeper insight into the technology behind the solution.
In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).
To give clear instructions on how to complete a recipe, we use these sections as follows:
This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.
This section contains the steps required to follow the recipe.
This section usually consists of a detailed explanation of what happened in the previous section.
This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.
This section provides helpful links to other useful information for the recipe.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "This should have created a folder called Base Enums."
A block of code is set as follows:
public void modifiedField(FieldId _fieldId){ super(_fieldId); switch (_fieldId) { case fieldNum(ConWHSVehicleServiceLine, ItemId): this.initFromInventTable( InventTable::find(this.ItemId)); break; }}
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In the Add New Item dialog, select Data Model from the left-hand list and Query from the right."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors .
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the
SUPPORT
tab at the top.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on
Code Download
.
You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Extending-Microsoft-Dynamics-365-for-Operations-Cookbook. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.
In this chapter, we will cover the following recipes:
Creating the Visual Studio Team Services project
Connecting Visual Studio to your Visual Studio Team Services
Creating a new Model and Package
Configuring project and build options
Creating a Label file
Microsoft Dynamics AX 2012 underwent a name change in what would have been version 7. The official name is now Microsoft Dynamics 365 for Operations. It isn't just that the version number has been dropped, but it appears to have been adopted into the Microsoft Dynamics 365 product suite. The product is not a component of Microsoft Dynamics 365, which is just a way to group Microsoft's various business solutions. We can't, therefore, shorten the name to Dynamics 365, we will refer the product by either its full name or the abbreviation Operations.
New features will be introduced to Operations as both a continual and cumulative process. There are two main types of update, Platform and Application. Platform updates are similar to the binary updates in prior releases, but also contain AOT elements that are now locked and can no longer be changed. Platform updates can contain changes to the language, and new features have been brought in with each bi-yearly release. When running in the Cloud, Microsoft will periodically release updates to the Platform for you. This is needed, since the it uses Azure SQL Server and they may need to service the platform in order to maintain compatibility to the database server.
Application updates are changes to the other packages that make up the source code of Operations, and can be considered similar to the meta data updates in previous releases of Operations.
This book was started on the May 2016, or Update 1 release and has been updated with each release. The version on publication is Update 5, released in March 2017.
All development work is carried out in conjunction with Visual Studio Team Services or VSTS. It used to be optional, but the implementation process that is managed through Lifecycle Services (LCS) requires that we have a VSTS project linked to it to function to its fullest. This is not just for source control and work management, but it is also used when performing code upgrades.
Please see the following links for further reading on Microsoft Dynamics 365 for Operations:
For more information on LCS, please see the link,
https://lcs.dynamics.com/Logon/Index
An overview of Microsoft Dynamics 365 for Operations for Developers and IT Pros is available at
https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/
To obtain an evaluation copy of Microsoft Dynamics 365 for Operations, please see the link,
https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/dev-tools/get-evaluation-copy
All development work in Operations is either performed on a development virtual machine hosted in Azure, or a local virtual machine. Each developer will use their own virtual machine. Azure hosted virtual machines are deployed through LCS under your own Azure subscription, and can be used to development, learning, and demonstration. Once, as a customer, a cloud hosted subscription has been bought, you are provided 3 environments as part of that subscription under Microsoft's subscription. These are Build, Sandbox, and Production. The build sever is a OneBox server (all in one virtual machine) that is also labelled Development, but it should always be used as a build server and not for development. The sandbox server is a full environment, with multiple servers using a separate Azure SQL Server. The production environment is the environment that you (as a customer) will go live with. All code must first be deployed to the sandbox before it is applied to live, which this is enforced by LCS - no more 'quick fixes' directly into live, and no access to SQL server for the production environment.
The on premise version of Operations may allow us to bypass some of these rules, but we shouldn't try - these practices of forcing code through a full testing cycle are very important. Waiting a couple of days for a needed feature may be inconvenient, but regression is perceived very negatively by users. During the implementation we ask a lot of the users, they are already busy with their jobs and are being asked to also help with testing new software, so user buy-in to the project is a critical factor, and regression is the most efficient way of eroding the initial excitement of delivering new software.
For local development virtual machines that are often the cheapest option, we will download the virtual machine from Microsoft Connect. This is a website used for many programs at Microsoft, and access is provided to partners and customers.
The terms Visual Studio Team Services and Team Foundation Server (TFS) are often used interchangeably. In Visual Studio, the user interface states that we are connecting to a Team Foundation Server. However, we are actually connecting to VSTS, which is an online service. VSTS is required for Operations development, and that is what we will use.
The project is normally created under the end-user's VSTS site, unless the work is being written as an ISV solution (or a personal development or learning project). The reason for using the client's VSTS system is that LCS is associated with the VSTS site, and support calls created through Cloud-powered support are generated within the associated VSTS. Cloud powered support is an online support solution within LCS that is exposed to the Operations client, allowing users to log support issues with their internal support team.
For up to five users, VSTS is free, and the customer can create many accounts with limited access without charge. These accounts as called stakeholder accounts, and allows the user access to work items, which also allows the users the ability to log support calls from within Operations. For those with an MSDN subscription, the five user limit is not counted.
This process is normally performed as part of the LCS project creation. If this were an implementation project type, the project is created when the customer signs up for Operations. The customer would then invite their Cloud solution provider (Partner) to the project. If this were an internal development project, such as a new vertical solution by an ISV, a Migrate, create solutions, and learn Dynamics 365 for Operations project type would be used.
In either case, we will have an LCS project, which will usually have an Azure VM deployed that acts as a build server.
For simplicity, and to keep the focus on software development, a project of type Migrate, create solutions, and learn Dynamics 365 for Operations was created for the purpose of the example of the book.
Before we get started, we will need an LCS project and a VSTS site. The VSTS site can be created through the following link:
https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx
Once we have the site created, we can then create our project.
To create the project, follow these steps:
Navigate to your VSTS site, for example,
https://<yourdomain>.visualstudio.com/
.
Under
Recent projects & teams
, click on
New
.
Complete the form as shown as follows:
Field
Value
Project name
Unique name, careful to name the projects for easy recognition, and how they are ordered. This is more important for ISVs who may have many projects.
Description
Short description of the project
Process template
Agile
Version control
Team Foundation Version Control
Press
Create project
.
Once complete, you can then navigate to your project and work with VSTS in order to plan your project.
To authenticate with LCS, we will need to generate a personal access token; to set this up, click on the control panel (cog) icon, as shown in the following screenshot:
This takes you to the control panel, again, on the top-right click on your name and choose
Security
, as shown in the following screenshot:
The personal access tokens option is selected by default; on the right-hand pane, click on
Add
.
On
Create a personal access token form
, enter a short description, for example, the LCS project name. Set the
Expires in
field based on how long you would like it to last for.
Leaving the
Accounts
and
Authorized scopes
fields as default; press
Create token
.
Finally, copy the resultant access code into a safe place; we will need it when we link VSTS to LCS. If we don't, we will have to create a new access token as you can't see it after the web page is closed.
Next, we will need to link the project to our LCS project. If an LCS project is not currently linked to a VSTS project, we get the following message on the left hand side, as shown in the following screenshot:
To configure VSTS for the LCS project, follow these steps:
To authenticate with LCS, we will need to generate a personal access token, so from within VSTS.
Click on the
Setup Visual Studio Team Services
button in the
Action center
dialog box.
On the
Enter the Visual Studio Team Service
site page, enter the URL of our VSTS site into the
Visual Studio Team Services site URL
field; for example,
https://<mysite>.visualstudio.com/
.
Enter the personal access token generated earlier into the
Personal access token
field.
Press
Continue
.
On the
Select the Visual Studio Team Service project
page, select the project from the
Visual Studio Team Service
list.
You are then shown the
Workitem type mapping
list. This allows you to select how to
LCS Workitem Type
/
LCS Workitem Sub Type
elements to
VSTS Workitem Type
elements. Leave this as the default and press
Continue
.
On the final
Review and save
page, press
Save
.
This takes us back to the main project page and the action center will ask you to authorize the project; click on
Authorize
.
You will be warned about being redirected to an external site; click on
Yes
.
You may be asked to log on; if so, do it with the account you use for VSTS, which might be your
Microsoft account
.
This will open the Authorize application page from within VSTS, and you will be told that you are allowing
Microsoft Dynamics Lifecycle Services
to access the VSTS and the specific permissions it will receive. Press
Accept
.
Operations uses VSTS for its source control, work, and build management. The only steps here that we technically must perform are step 1 through step 5, but without performing the previous steps, we lose the ability to integrate LCS. If our project was for a customer implementation, we should consider it mandatory to integrate VSTS with LCS.
For more information on VSTS and LCS, please check out the following links:
AX Dev ALM usage guide and resources
(
https://blogs.msdn.microsoft.com/axdevalm/
)
LCS for Microsoft Dynamics 365 for Operations customers
(
https://ax.help.dynamics.com/en/wiki/how-lifecycle-services-for-microsoft-dynamics-ax-works-lcs/
)
Developer topology deployment with continuous build and test automation
(
https://ax.help.dynamics.com/en/wiki/developer-topology-deployment-with-continuous-build-and-test-automation/
)
The next link is useful background knowledge, but a lot of this is one for you when using an implementation LCS project:
Set up technical support for Microsoft Dynamics 365 for Operations
(
https://ax.help.dynamics.com/en/wiki/ax-support-experience/
)
This link is for when we have a customer implementation project and demonstrate some of the synergy of leveraging VSTS and LCS with Operations.
Each developer has their own development VM, hosted either in Azure or locally. This is by design and is part of the application lifecycle process. Each developer would get the latest code from source control, and then check in their changes according their organization's development methodology. As part of this check in they can link the check-ins. This allows a build to then be created, and we gain a level of traceability since each work item (user story, feature, bug, and so on.) is linked to the check-ins in that build. This also allows test projects to be automatically executed when the build is generated.
Once the virtual machine has started, ensure that it has Internet access, and that you have used the admin user provisioning tool to associate your O365 account with the administrator account of Operations.
Before you start this, especially when working in a team, we must rename the VM to make it unique across our team; see the There's more... section for details on this.
To connect Visual Studio to VSTS, follow these steps:
Create a folder for your projects, and underneath a subfolder with your initials, or others that make the folder unique, within your team; in my example, I chose
C:ProjectsTFS
.
Start Visual Studio.
You will be presented with the licensing page. Use the page to log in to the account used to create the project within VSTS. Which could be either your Microsoft account, or Work (O365) account.
On the top toolbar, select
Team
and then
Manage connections
.
The Team Explorer will open, under default layout, on the right-hand side. On this pane, select
Manage Connections
|
Connect to Team Project
:
This will open the
Connect to Team Foundation Server
dialog, in the
Select a Team Foundation Server
drop-down list and select your VSTS site.
Select your project in the lower portion of the dialog, as shown in the following screenshot:
After pressing
Connect
, Visual Studio is connected to your project.
We have one final step before we continue; we have to configure our workspace so Visual Studio knows which folders are under source control and how they map to VSTS. On Team Explorer, click on
Configure workspace
under the
Project
section. This will show the
Configure Workspace
section at the top of the Team Explorer.
Do not press
Map & Get
.
Press
Advanced...
.
The
Edit Workspace
dialog will look similar to the following screenshot:
For Operations development, we will need to map a projects folder and the Operations local packages folder (the application source code, or metadata as it is often referred to) to two different folders in VSTS. The Projects folder is the one we created earlier, which was C:ProjectsSB in my case. The Operations local packages folder is C:AOSServicePackagesLocalDirectory.
In my case, the project is
B05712_AX7_DevelopmentCookbook
, so I will configure the dialog as shown in the following screenshot:
Press
OK
.
You will then be told that the workspace has been modified, and if you want to get the latest code. Either option has no effect if we are the first developer, but it is a good habit to always press
Yes
.
Source control in Operations has come a long way in this release, mainly because our development tool is now Visual Studio and that the source files are now actual files in the file system. Operations no longer needs special code to integrate with a Team Foundation Server.
The reason we have two folders is that our projects don't actually contain the files we create when writing code. When we create a file, such as a new class, it is created within the local packages folder and referenced with in the project. This also means that we can't just zip up a project and e-mail it to a co-worker. This is done by connecting to the same VSTS project or using a project export feature.
When working with multiple developers, one often overlooked task is to rename the virtual machine. This has gotten easier with each update, and the steps we take at the current release are as follows:
Use Computer management to rename the machine. Use something like project ID and your initials for this; for example,
B05712SB
.
Restart the virtual machine.
Use the SQL Server Reporting Services configuration utility so that it references the correct server name.
Renaming a VM
(
https://ax.help.dynamics.com/en/wiki/visual-studio-online-vso-machine-renaming/
)
Configuring your VSTS mapping after a code upgrade
(
https://ax.help.dynamics.com/en/wiki/configuring-your-vso-solution/
)
When creating a new project, it is usually a new Package and a new Model. This keeps things simple, and there is usually no benefit in separating them. You may wish to create a test project in a different Model in the same solution, but you may not wish to deploy the test projects to live.
There are two types of projects: an extension project and an over-layer project. Over-layering means modifying the source code of Operations, and requires a code upgrade for each application hotfix. Extension projects work on delta changes to the standard object, or using delegates to affect code execution. Extension projects shouldn't need a code upgrade when application hotfixes are applied. Avoidance of over-layering cannot be overstated, in the time this book was being written Platform and Foundation have been locked, meaning that the over-layering must be removed. The ability to write good code through extension has been improved with each release, and with clever design the need to over-layer has been significantly reduced.
We will use extension projects exclusively, in order to to avoid conflicts with future upgrades. They make it possible to service the environment without having to deploy a new build of the custom solution. This is very exciting for ISV solutions, but also very important for VAR and end-user customers.
See the There's more... section for information on the relationship between packages, models and projects.
Startup Visual Studio and ensure that we are correctly connected to VSTS. As of the current release, you must start visual studio as an administrator.
To create the project, follow these steps:
Under the
Dynamics 365
menu, choose
Model Management
|
Create model...
.
The Model name is named as we would in AX 2012, and should be named like a new type, such as
<prefix><area/module><ShortName>
.
Complete the first steps as follows:
Field
Value
Model name
In our case, our company is called Contoso, so our prefix will be Con, the area of change is an existing module (WHS) and it is for general extensions (extending standard objects without customization).
It is therefore named ConWHSGeneralExtensions. You should use your own prefix and prefixes, and the name for explained further in the There's more... section.
Model publisher
Your organization's name.
Layer
As follows:
ISV / vertical solution / add-on: ISV
VAR / Partner solution / add-on: VAR
Customer solution / add-on: CUS or USR
The customer layers were traditionally used to segregate a customer's global solution layer from the requirements of each country implementation.
The layer technology is processed very differently for the extension projects, and has lost some significance in this release.
Version
Leave as 1.0.0.0
You can update this to maintain a version of the model. This does not auto-increment and is usually left as default.
Model description
A full description of the model for other developers to read.
Model display name
Leave as default, which should be the Model name.
Press
Next
.
In the Select package page, choose
Create new package
.
Press
Next
.
We are now offered a list of packages that we can reference, these are listed as package's name and the models that the package contains, check
ApplicationSuite
and press
Next
.
The two check boxes,
Create new project
and
Make this my default model for new projects
, should both be checked.
Press
Finish
.
This opens the
New Project
dialog. The project name is usually the same as the package and Model name; then, enter the package name in the
Name
field.
The
Location
field must be changed; it will create the project in the default project folder, but we linked
C:Projects<initials/username>
to source control. The project must be created under this folder. So, in my case,
Location
must be
C:ProjectsSB
.
The
Solution name
field should be left as the project name.
Ensure that both
Create directory for solution
and
Add to source control
are checked.
Press
OK
.
To see what we just did, we can simply look at the results. Use Windows explorer to navigate to the local packages folder, which is usually, C:AOSServicePackagesLocalDirectory. There, you will see the following structure, for the example package, ConWHSGeneralExtensions:
Folder
Description
ConWHSGeneralExtensions
This is a package folder
+ ConWHSGeneralExtensions
This is a model folder with a subfolder per type
+ Descriptor
This contains a descriptor file for each model
+ XppMetadata
