Microsoft Dynamics AX 2009 Integration and Development with .NET Framework Office Business Applications for Microsoft Dynamics AX Agenda • Introduction to Office Business Applications (OBA) for Microsoft Dynamics – Business Problem – Introducing Office Business Applications – Deployment • Development Side of Office Business Applications – Visual Studio Tools for Microsoft Office – Microsoft Dynamics AX .NET Business Connector Microsoft Dynamics AX 2009 Integration and Development with .NET Framework Introduction to Office Business Applications Business Problem • Recent research studies showed: – 85% of employees in an organization are not licensed for business management systems – Of the 15% that are, just over half of them actually use it • About 93% of employees have no direct access to data regarding their business • The systems meant to enhance workflow and decision-making throughout the organization are left to a small group of power users, dramatically diminishing ROI Introducing Office Business Applications OBAs: • Bring together front office and back office • Make ERP systems more accessible • Make information actionable by information workers through the familiar, powerful, and ubiquitous Microsoft Office System • Built on the Office Business Application Platform Microsoft Office System Line-ofbusiness Applications What are OBAs for Microsoft Dynamics? Office Business Applications for Microsoft Dynamics are designed to connect information workers with Microsoft Dynamics information from within the Microsoft Office Suite Microsoft Dynamics Snap Microsoft Dynamics Snap applications are OBAs designed to connect Line of Business (LOB) systems with the people that use them through the familiar user interface of Microsoft Office. Snap Applications Available Today Snap Allows you to… From within: Business Data Search Search for unstructured data across ERP, CRM and SharePoint sites Outlook Business Data Lookup Search for and insert Dynamics data into the document, spreadsheet or email you are working on Word, Excel, Outlook Custom Report Generator Export and analyze Dynamics data in Excel, upload changes back to the system Excel Timesheet Management Report your time directly from your Outlook calendar Outlook Vacation Management Create, submit, approve/reject, and track status and history of vacation requests Outlook Expense Management Create, submit and approve/reject expense reports Excel, SharePoint Customer Journal Capture customer data for offline meetings then upload any relevant changes InfoPath OBA Deployment Architecture Client Side VSTO 2008 Microsoft Office Office Add-Ins Microsoft Dynamics AX 2009 .NET Business Connector Server Side Microsoft Dynamics AX AOS SQL Server OBA Deployment Options Office Client-based add-ins: - Work with Outlook, Word, Excel, and InfoPath - Deployed via SMS or Group Policy - Versions specific to the Microsoft Office 2007 system and the 2003 Microsoft Office system - ClickOnce deployment technology Office SharePoint Server-based add-ins: - Built for Microsoft Office SharePoint Server 2007 - Support a single SharePoint Server deployment Demo Retrieve Customer Information to Excel Development Side of OBA for Microsoft Dynamics AX OBA Development: Client Platform Investments • • Ribbon Core Features • Task Pane • Application add-in • • .NET Business Connector Application Integration Framework Microsoft Dynamics AX Open XML File Format Enhanced add-in model Customizable User Interface • Custom ribbon, ribbon designer • Custom task panes Word • Custom XML, data binding Excel • BI functions, server support Outlook • Unified object model OBA Development: Server Platform Investments • Office SharePoint Server 2007 • • Office SharePoint Server • • • Windows SharePoint Services Windows SharePoint Services • • • • ASP.NET SQL Excel Services InfoPath Forms Services Business Data catalog Content management ASP.NET integration Workflow support Content types and meta data Feature and solution deployment Client + Server = Powerful Solutions Platform Office Business Applications Dynamics AX ISV OBAs Business Intelligence Content Management 2007 Office system clients Open XML File Formats and Extensible Fluent Interface • Search • Workflow • Business Data Catalog • Website & Security Framework • Excel Services Microsoft Dynamics AX .NET Business Connector Office Communications Server 2007 Office SharePoint Server 2007 Exchange Server 2007 Microsoft Office System Microsoft Dynamics AX Application Integration Framework Dynamics AX Microsoft Visual Studio Tools for Office … Unified Communication & Collaboration Custom OBAs OBA Apps as a Reach Channel Application Generated Tasks & Notifications Document Integration 2007 Microsoft Office System Collaborative Site Discovery Navigation Composite User Interface Complementary Document Workflow Real-World Cases Customers and ISVs Common OBA Patterns Technologies • Microsoft Visual Studio 2008 • Visual Studio Tools for Microsoft Office 2007 • New InfoPath form or Project/Excel/Word Add-Ins • Add controls in forms, write event handlers • Microsoft Dynamics AX 2009 AIF or Business Connector • Used to interface with Microsoft Dynamics AX 2009 What is VSTO? • Makes Office a valuable, first-class project type in VS • Enables developers to create and extend OBA • Enables developers to leverage key Office UI features and support collaboration and workflow • Provides Office developers with advantages of the VS professional development environment • Allows developers to leverage existing programming skills • Developers can leverage their company’s current investment in Office 2003 Pro and new investment in 2007 Office system Some Examples Basic Features of VSTO • Visual designers for key UI features • Workflow and Microsoft SharePoint support • Data-bound Word Content Controls • App-level add-ins for most client programs • Doc-level add-ins for Excel and Word 2007 • ClickOnce deployment and security Basic Features of VSTO Ribbon Designer Ribbon Editor Ribbon Control Toolbox Property Grid VSTO Runtime Components VSTO Runtime Office Host Unmanaged Runtime Loaders DefaultDomain Managed Runtime •Check security •Fetch updates •Create appdomain •Connect Office host •Host item controls •Managed controls AppDomain #2 Usercode Add-in/#3 AppDomain Doc Usercode customization Add-in/ Doc customization Building Task Panes • Deliver additional data to the user to act upon or integrate within Office documents • OBA Intelligent Document Pattern • Two types of panes: – Actions Pane • Associated with a specific Word or Excel document – Custom Task Pane: • The same general idea as Actions Pane, only on the application add-in level, not an individual document Task Pane Persistence Models • Actions Pane • Custom Task Pane How to Program Ribbon and Task Pane Interaction • • • Implement a custom task pane Declare global variable which will indicate state of your task pane visibility in ThisAddin class Implement methods which will manipulate your task pane in ThisAddin class: AddTaskPane method: ctpCustTaskPane = this.CustomTaskPanes.Add(new CustTaskPane(), "Caption"); ctpCustTaskPane.VisibleChanged += new EventHandler(CustTaskPane_VisibleChanged); ctpCustTaskPane.Visible = true; RemoveTaskPane method: this.CustomTaskPanes.Remove(ctpCustTaskPane); • Implement Ribbon callbacks in your Ribbon class – Toggle task pane visibility inside “Click” handler of RibbonToggleButton control Outlook Form Regions • Additive UI enhances Outlook’s built-in forms • Adjoining and Separate Regions for both custom and built-in forms • Regions are created in Outlook Forms Designer • Forms solution implemented via Add-in • Deployment via Windows registry Outlook Form Regions • VSTO 3.0 simplifies and speeds up Outlook form region design and configuration process with a visual designer and a wizard – – – – – Achieve maximum form region design flexibility with VS visual designer Configure your form region with a simple, intuitive wizard Run and debug your form region right from VS (F5) No need to manually handle manifest XML, OFS files, registry entries, etc. Option to import Outlook-created OFS file VSTO Deployment The deployment process involves the following considerations: • • • • • Office solution requirements Deploying an Office solution Installing an Office solution Updating an Office solution ClickOnce cache What is .NET Business Connector? • Standalone Microsoft Dynamics AX component • Set of managed classes that provide easy access to X++ functionality in Microsoft Dynamics AX Characteristics • Requires Microsoft® Windows® authentication • Automatically registered during installation • Can be used to implement and deploy both clientbased applications, such as Microsoft Office add-ins and server-based applications • Has a Business Connector Proxy user, which "acts-on-behalf-of“ Microsoft Dynamics AX users who cannot be fully authenticated Business Connector Architecture The Business Connector run-time interactions Managed classes Transition layer Interpreter layer Managed Classes The following managed classes are provided by the .NET Business Connector: • Axapta • AxaptaBuffer • AxaptaContainer • AxaptaObject • AxaptaRecord • VariantWrapper All these classes are found in the namespace: Microsoft.Dynamics.BusinessConnectorNet, and assembly Microsoft.Dynamics.BusinessConnectorNet (in microsoft.dynamics.businessconnectornet.dll which is located in the Bin directory in the Microsoft Dynamics AX Client directory) Examples of Usage Axapta ax = new Axapta(); ax.Logon(CompanyName, Language ,ObjectServerName,Configuration); ax.Logoff(); Declare variable instance of Axapta class Call Logon() method. Parameters are: name of company, language, Applciation Object Server name, and path to configuration file. For default values pass null Logoff method disconnects from AOS AxaptaRecord axRecord = ax.CreateAxaptaRecord("InventTable"); axRecord.ExecuteStmt("select * from %1 where %1.ItemGroupId == 'RawMat'"); Declare variable instance of AxRecord class ExecuteStmp receives x++ statement and executes it Example of Realization … using Microsoft.Dynamics.BusinessConnectorNet; … Axapta ax; String invItemNameField = "ItemName"; Object invItemName; String invItemIdField = "ItemId"; Object invItemId; // Log on. ax = new Axapta(); try { ax.Logon(null, null, null, null); } catch (Exception) { Console.WriteLine("Exception occurred"); } Console.WriteLine("*** List inventory item records"); AxaptaRecord axRecord = axCreateAxaptaRecord("InventTable"); // Execute a query. axRecord.ExecuteStmt("select * from %1 where %1.ItemGroupId == 'RawMat'"); // Loop through matching Dynamics AX records. while (axRecord.Found) { invItemName = axRecord.get_Field(invItemNameField); invItemId = axRecord.get_FieldinvItemIdField); Console.WriteLine(invItemId + "\t“ + invItemName); axRecord.Next(); } axRecord.Dispose(); // Log off of Dynamics AX. ax.Logoff(); Sources of Additional Information • Office Business Applications Developer Portal http://msdn2.microsoft.com/en-us/office/aa905528.aspx • Office Solution Development Overview http://go.microsoft.com/fwlink/?LinkId=60064 • Office Solution Architecture Overview http://go.microsoft.com/fwlink/?LinkId=60065 • .NET Business connector http://msdn2.microsoft.com/en-us/library/aa834438.aspx Demo Develop OBA for Microsoft Dynamics AX Q&A Introducing the Lab • In this lab you will: - Create a new VSTO project based on Excel 2007 add-in template - Create custom task pane - Create connector class for Microsoft Dynamics AX and Excel integration - Create new Excel template © 2008 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.