Book Image

Extending Microsoft Dynamics AX 2012 Cookbook

By : Murray Fife
Book Image

Extending Microsoft Dynamics AX 2012 Cookbook

By: Murray Fife

Overview of this book

Dynamics AX is built on a number of foundation products from Microsoft that are used to make it bigger, better, and stronger than the average business system. Taking advantage of these products will make your life easier. Use these tools to maximize the efficiency of your business management, taking advantage of a powerful and centralized tool set. "Extending Microsoft Dynamics AX 2012 Cookbook" will show you how to use tools that you already have to extend out Dynamics AX and discover potential new directions. You will be surprised at what you can do on a shoestring budget. The book will allow you to streamline your work processes, and use the system's powerful and centralised features to the advantage of your organization. "Extending Microsoft Dynamics AX 2012 Cookbook" will show you how to maximize the potential of Dynamics AX with common and popular tools to enhance your business management systems. We will begin by exploring how to extend Dynamics AX out with SharePoint. After this, the book will guide you through important elements in maximizing business management efficiency, focusing on key aspects like reports, dashboards, and workflows. The book will then finish by teaching you how to customize your management systems, achieving a comprehensive coverage of the most important extension processes relevant to you and your business with very little programming. This is a book for those of you that want to make the most out of Dynamics AX by using what you already have, and without breaking the bank.
Table of Contents (18 chapters)
Extending Microsoft Dynamics AX 2012 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Linking document libraries to Dynamics AX records


Now that you have a document library configured, you can make it accessible directly from the Dynamics AX forms, and have it automatically filtered so that you just see the documents that are associated to the information that you are looking for.

In this recipe, we will show how you can link the document library that we just created to the Vendor form, and do just that.

Getting ready

This example requires that you access the development environment and make changes to forms. Before you start on this example, make sure that you have developer rights on your installation of Dynamics AX. To check this carry out the following steps:

  1. Open up the form that you are going to modify.

  2. Right-click on the form and navigate to the Personalize option.

  3. Click on the Information tab and you should be able to see the system form name:

  4. Click on the Edit button to the right of the form name and you should be taken into the AOT development environment.

How to do it...

To add a link to a SharePoint document library within a form, follow these steps:

  1. Create a new development project in AOT, AccountsPayableSharePointDocs. Add the VendorTable form to the project:

  2. We are going to add a new tab group to the VendorTable form to show the documents that relate to the Vendor record. To do that expand the Designs group and find the Design form definition. Expand MainTab and TabPageDetails, and then right-click on the Tabs group, navigate to New Control, and then TabPage:

  3. Rename TabPage to AccountsPayableDocuments and also add a caption for TabPage in the properties box of Vendor Documents.

  4. We need to add a browser to the form so that we can display the SharePoint documents window. To do this, right-click on the new tab that we created, navigate to the New Control menu, and then select the ActiveX control.

  5. When the ActiveX control browser shows up, navigate to the Microsoft Web Browser control, and add it to the tab.

  6. In the properties panel for the Web Browser control, set the Name property to Documents, set the Width property to Column width, and the Height property to Column height, so that the control will fill the space that is available in the tab control:

  7. Now that we have a control to show the SharePoint site with the documents, we just need to initialize it when entering the vendor form. To do this, right-click on the Methods group in the VendTable form, select the Override method menu, and then activate:

    Code Snippet 1: VendTable Form activate method

  8. This will open up the code editor for the activate method. We will change this by creating a URL string that references the Accounts Payable document library in SharePoint, and then navigate the browser control to the URL, as follows:

    public void activate(boolean _active)
    {
        String255 url = “http://intranet.contoso.com/
          Accounts%20Payable%20Documents/Forms/
            AllItems.aspx?IsDlg=1”;
    
        url = url + “&FilterField1=AccountNum&
          FilterValue1=” + VendTable.AccountNum;
        url = url + “&FilterField2=Company&
          FilterValue2=” + VendTable.dataAreaId;
        Documents.Navigate(url);
    
        super(_active);
    }
  9. Two items to note, we added the IsDlg=1 qualifier to the URL which removes all of the navigation and gutter options on the page, and also the Filter qualifiers will automatically add a filter on the AccountNum field, and the Company indexes.

  10. Now we can save the project, and we are finished.

How it works...

When we open up the Vendor Detail form, we will see a new tab at the bottom of the page that will list the documents that are indexed with Vendor Account Number:

At any time, the users are able to open up the documents, and view the scanned images.