Extending Microsoft Dynamics AX 2012 Cookbook

By Murray Fife
    Advance your knowledge in tech with a Packt subscription

  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Extending Out with SharePoint

About 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.

Publication date:
August 2013
Publisher
Packt
Pages
314
ISBN
9781782168331

 

Chapter 1. Extending Out with SharePoint

In this chapter, we will show you how to take advantage of some of the features within SharePoint, to help you add value to Dynamics AX through My Sites and Document Repositories. This chapter will cover:

  • Configuring a My Site host site

  • Using note boards to microblog from the Role Centers

  • Adding My Site profile links to the Role Centers

  • Creating shared document libraries

  • Linking document libraries to Dynamics AX records

 

Introduction


SharePoint is one of the core Microsoft technology platforms which allows you to organize your files with shared document libraries, collaborate with others through shared task lists and calendars, communicate with others with blogs, and much more, all through a web portal. Something that makes SharePoint even more useful is that you don’t have to be a developer to configure these features.

If you have Dynamics AX up and running, then chances are you should already have SharePoint installed and configured, since it is also the foundation for all of the Role Centers and enterprise portals that are delivered with Dynamics AX. Although the Role Centers and portals are preconfigured and use a lot of the features of SharePoint, there are still more features that you can take advantage of in conjunction with Dynamics AX that will make your system even better.

First we will show how to configure the My Sites feature so that the users are able to microblog and maintain their personal information within SharePoint. Once you have this configured, then you are able to add content from your personal My Site, or links to other My Sites into the Role Centers in Dynamics AX. This provides a better collaboration system for the business, and also adds a social element to the application.

We will also show how you can create your own document libraries within SharePoint to allow users to store documents, such as scanned invoices, and then index and link them back to Dynamics AX. This is an alternative to the standard document attachments feature within Dynamics AX. SharePoint document libraries allow multiple records to be linked to the same document list, and also give you document management features, such as file check-in and out to control who updates the documents.

None of these examples are hard to set up or configure, but since they require you to add to your existing SharePoint sites, you will need to have administrator rights to SharePoint. Also, for the last two examples, there is some X++ coding required. Each has only about 10 lines of simple code, so even novices should be able to work through the examples.

 

Configuring a My Site host site


SharePoint My Sites give your users the chance to have their very own part of SharePoint that they can use to store documents, to update their own personal profile and description, to make notes and blog entries and also to connect with other people within the organization. In a socially connected workplace, My Sites are great tools to allow the users to post and capture knowledge.

If you do not have My Sites configured, then the first step is to create a My Sites site within SharePoint and link it to your Role Centers so that the users will then be able to access their personal profile and content.

Getting ready

Before you start on this example, you will need to make sure that you have access to the SharePoint Central Administration console. To check this:

  1. Access your server that has SharePoint installed on it.

  2. From the program menu, you should be able to find the SharePoint Central Administration Console in the Microsoft SharePoint Products group.

  3. When you open the application, you should see a screen similar to this:

How to do it...

To create and link your own My Sites site, follow these steps:

  1. From your SharePoint Central Administration console, navigate to the Application Management group.

  2. Select the Create Site Collection from the Site Collections group.

  3. Name your application My Sites.

  4. Set the website address to be in the my/personal folder, and name the subfolder My Sites.

  5. From the Enterprise tab on the Template selection choose My Site Host.

  6. Don’t forget to assign the Primary and Secondary administrators to the site that you are creating:

  7. Click on OK to create your site.

  8. From the Application Management option in Central Administration, select the site that we added the My Sites host site to.

  9. Click on the Define button in the ribbon bar, and then select the Managed Paths option:

  10. Here we will add our new My Site link. You don’t need to type in the full URL, so you can skip the host prefix.

  11. Also, you may just want to check the Self-Service Site Creation option, to make sure that the feature is turned On:

  12. Finally, we need to configure the User Profile Service application.

  13. When you select the application, you will be able to see all of the My Site and user profile configuration options. From here you need to choose the Setup My Site menu option.

    Tip

    Remember this link because you may need to come back here later to configure profiles, and so on.

  14. We just need to configure the site parameters, the administrator users, and so on.

    Tip

    Make sure that the host URL matches, that is, SharePoint.

How it works...

Once you have My Sites configured, you will see a My Site option when you select the drop-down menu under the user name within SharePoint, as follows:

Opening up your My Site will take you to your personal site within SharePoint. Initially it will be a little dull, but since you will be the administrator of this little slice of SharePoint, you can add information and pictures to your profile, create your own blogs, and browse through the organization to see other’s My Sites to see what they are up to. You also have your own personal documents area that you are able to save files to, that you can then share with other users in the organization.

 

Using note boards to microblog from the Role Centers


A part of your My Site is a personal note board. If you don’t want to create a full-fledged blog, then you can use this to take quick notes for yourself or others within the organization, such as reminders that you will be on vacation, alerts about upcoming events, and much more that you can publish to the entire organization.

In this recipe, we will show you how to make this even more useful by adding the note board directly into the Dynamics AX Role Center. This will allow your users to view your posts quickly and get back to work, without having to open another window.

How to do it...

To add a note board panel to the Role Center, follow these steps:

  1. From within the Role Center, click on the Personalize this page link in the top-right hand corner to enter into the edit mode.

  2. Click on the Add a Web Part link where you would like to add the note board.

  3. This will open up the web part explorer. From the categories, select the Social Collaboration group and this will filter the available web parts to the My Site controls.

  4. Select the Note Board control and click on the Add button:

  5. Now click on the Stop Editing button to return to the view mode for the Role Center.

How it works...

Since the Note Board is a direct link to the user’s personal My Site Notes, they are able to post directly from Dynamics AX without opening up another browser window:

The notes that are posted on the Note Board on the Role Center will show up on the Tags and Notes panel within the user’s My Site page. Additionally, if the user makes notes from their My Site, then these will show up on the wall of the Role Center.

 

Adding My Site profile links to the Role Centers


Another feature of My Sites is the ability for users to personalize their own profile with descriptions, contact details, profile pictures, and also personal notes and interests. Users configure and update their profiles, and then these can be used as a company directory, and an easy way to get to know the people you work with.

In this recipe, we will show how you can add your profile link to the Dynamics AX Role Center to give you quick access to your own My Site, and also how to add people that you frequently contact on your Role Center for quick access.
Getting ready

Before you start on this example, you will need to make sure that you have configured your own personal profile within your My Site. To do this carry out the following steps:

  1. Access your My Site by selecting the My Site option on the drop-down menu under your name in SharePoint.

  2. Once you are in your My Site, click on the My Profile link in the top-left hand corner to access your profile page.

  3. Click on the Edit My Profile link under your profile picture.

    This will open up the Profile Maintenance page allowing you to add descriptions, avatars, and any other information that you may want to include on your profile:

How to do it...

To add a Contact Details panel to the Role Center, follow these steps:

  1. From within the Role Center, click on the Personalize this page link in the top-right hand corner to enter into the edit mode.

  2. Click on the Add a Web Part link where you would like to add your contact information.

  3. This will open up the web part explorer. From the categories, select the Social Collaboration group and this will filter the available web parts to the My Site controls.

  4. Navigate to the Contact Details control, and then click on the Add button:

  5. This will add the Contact Details web part to the Role Center, but you need to configure it with a contact. To do that, navigate to Click here to add or modify a contact link.

  6. This will open up the Web Part properties panel, and you will be able to select a contact from the address book:

  7. Click on the Stop Editing button and you are done.

How it works...

Once you have defined a contact for Contact Details, then the information from the My Site of that person will be displayed on the Role Center:

If you click on the name of the person, then that will take you directly to their personal site:

 

Creating shared document libraries


One of the strengths of SharePoint is that it is a great document management system. Although you can attach documents to records directly within Dynamics AX, you may want to use SharePoint as a store, so that people without access to Dynamics AX can still have access to the documents. SharePoint also allows you to index documents a number of different ways, allowing them to link to more than one record within Dynamics AX.

For this recipe, we will show how you can create an Accounts Payable document library to store all of your vendor invoices and scanned documents.

Before we show you how to access these documents from within Dynamics AX, you need to create a library to store the documents.

Getting ready

Before you start on this example, you will need to make sure that you have administrator privileges on your document management site. To check this carry out the following step:

  1. Access the site, and open up the Site Actions menu. You need to make sure that you have the ability to create a New Document Library:

How to do it...

To create a new document library for your Accounts Payable scans and images, follow these steps:

  1. From your SharePoint site that you want to store your documents in, access the Site Actions menu, and then select the New Document Library menu item:

  2. This will open up the Document Library creation form. Give the library a name for the area of the business that will be using the documents, and then click on the Create button:

  3. Now you should have a generic document library. We want to be able to index and search through our documents though. So we will add a few index fields to the document library. To do this, click on the Create Column button in the Library/Manage Views section of the ribbon bar:

  4. This will open up the Create Column dialog box, and we will create a column for Vendor Account Number:

  5. After doing that, create non-required columns for Invoice Number (AccountNum), Document Amount (Amount), Document Date (Date), Purchase Order Number (PurchaseOrder), and Company ID (Company).

  6. From the Library/Manage Views tab on the ribbon bar, you may also want to rearrange and hide the columns to make the library tidier.

How it works...

From the document library, we can now upload our scanned documents and images to SharePoint through the Upload Documents button.

Once you have your documents uploaded, you can the open up the Properties panel for the document through the drop-down box beside the document name.

The column properties allow you to add additional index information to documents, so that later on we are able to search and find documents that relate to specific data in the database.

As we index these documents we are able to see the indexed column values in the main view of the document library.

Additionally, if you have a number of documents in your library, you can use the filter button to just find the documents that you are looking for.

 

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.

 

Summary


SharePoint is a great tool for sharing and collaborating, and is even more useful because you don’t need to be a developer in order to set it up. In this chapter we looked at just a couple of the features that you can use with Dynamics AX, but there are a lot more that you can take advantage of.

Some other ways that you can use SharePoint include:

  • Creating knowledge bases with Wiki’s, allowing the users to collaboratively update information related to products, customers, vendors, or other records in the system

  • Enabling blogging within SharePoint so that users can share business insights with everyone else in the organization

  • Adding document workflows to manage the approval of documents such as Invoices

Since you probably have SharePoint up and running, then it would be a shame not to take advantage of it.

About the Author

  • Murray Fife

    Murray Fife is a Microsoft Dynamics AX MVP, a presenter, and an author with over 18 years of experience in the software industry. Like most people he has paid his dues as a developer, as an implementation consultant, and a trainer. He has a hard-to-find blend of technical and interpersonal skills and spends his days working with companies solving their problems with the Microsoft suite of products, specializing in Dynamics AX solutions.

    Browse publications by this author
Book Title
Unlock this book and the full library for FREE
Start free trial