Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Extending Microsoft Dynamics AX 2012 Cookbook

You're reading from   Extending Microsoft Dynamics AX 2012 Cookbook This is a brilliantly accessible book, packed with practical examples, that's perfect for business professionals who want to make more of the advanced features of Dynamics AX to save money and increase management efficiency.

Arrow left icon
Product type Paperback
Published in Aug 2013
Publisher Packt
ISBN-13 9781782168331
Length 314 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Murray Fife Murray Fife
Author Profile Icon Murray Fife
Murray Fife
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Extending Microsoft Dynamics AX 2012 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Extending Out with SharePoint FREE CHAPTER 2. Reports and Dashboards 3. Dashboards, Charts, and Scorecards 4. Communication and Collaboration 5. Using Cases to Manage Incidents and Requests 6. Organizing Your Workflows 7. Reporting in Office 8. Talking to the Outside World 9. Creating Help 10. Web Services and Forms 11. Role Center Personalization and Customization 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.

You have been reading a chapter from
Extending Microsoft Dynamics AX 2012 Cookbook
Published in: Aug 2013
Publisher: Packt
ISBN-13: 9781782168331
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image