From July 9th till 13th we will be at #MSInspire. See you there!

How to Configure Document Management in MS Dynamics AX 2012

How to Configure Document Management in MS Dynamics AX 2012
24 Oct 2014

Document management or document handling is a key feature in any ERP. Dynamics AX 2012 also provides full featured document management or document handling functionality, such as the ability to create document templates and reuse them for generation of records like purchase orders, project budgets, service orders, sales orders, etc.; and file attachment – for attaching files to a record in the form of PDF, MS Word docs or Excel sheets.

In this post, we’ll walk through the steps you need to take in order to configure Document Management in MS Dynamics AX 2012. We’ll also look at some some sample code that depicts how to attach documents to a record in Dynamics AX 2012.

Given below are the recommended guidelines or steps for how to configure document management in MS Dynamics AX 2012. These need to be executed in sequence.

  1. Activate document management
  2. Specify a document archive directory
  3. Specify a numbering sequence for your documents
  4. Specify the file types you intend to use
  5. Configure the integration with office add-ins (optional)
  6. Create or import document type
    • Configure document management for SharePoint (optional)
    • Configure document categories (optional)
  7. Specify content type
  8. Specify document management settings in AIF

How to Configure Document Management in Dynamics AX 2012

Given below is some sample code for attaching a document with a particular record in Dynamics AX 2012 that’ll help get you started.

[AifDocumentCreateAttribute, SysEntryPointAttribute(true)]public boolean createAttachment(RefRecId refRecId, RefTableId refTableId, str refCompanyId,
str docuDesc, str docuNotes, str docuTypeId, str fileName)

DocuRef docuRef;
DocuValue docuValue;
recid docuValueRecId;
DocuActionArchive archive;
boolean saved;

saved = false;

// Save DocuRef
docuRef.RefRecId = refRecId;
docuRef.RefTableId = refTableId;
docuRef.RefCompanyId = refCompanyId;
docuRef.Name = docuDesc;
docuRef.Notes = docuNotes;
docuRef.Restriction = DocuRestriction::Internal;
docuRef.Name = docuDesc;
docuRef.TypeId = docuTypeId;;

// Add archive File
saved = archive.add(docuRef, ‘File Path’);

// Save DocuValue
docuValue.FileName = savedFileName;
docuValue.FileType = savedFileExtension;

// Update DocuRef and DocuValue References
docuRef.ValueRecId = docuValue.RecId;

return saved;


And that’s it!

About Folio3 Dynamics Services

FDS (Folio3 Dynamics Services) is a dedicated division of Folio3 that specializes in Microsoft Dynamics AX, Dynamics CRM, Dynamics NAV and Dynamics GP based development, customization and integration services. Our main focus is on Enterprise Mobility. We firmly believe that opening up Microsoft Dynamics AX and other products to iOS Android, Windows 8 and Windows Phone users will have a huge impact on organizational agility and productivity.

If you have a Dynamics AX based development project you’d like to discuss or would like to know more about our Dynamics AX development services, please get in touch with us.