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.
- Activate document management
- Specify a document archive directory
- Specify a numbering sequence for your documents
- Specify the file types you intend to use
- Configure the integration with office add-ins (optional)
- Create or import document type
- Configure document management for SharePoint (optional)
- Configure document categories (optional)
- Specify content type
- Specify document management settings in AIF
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;
ttsBegin;
// Save DocuRef
docuRef.clear();
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;;
docuRef.insert();
// Add archive File
saved = archive.add(docuRef, ‘File Path’);
if(saved)
{
// Save DocuValue
docuValue.initValue();
docuValue.FileName = savedFileName;
docuValue.FileType = savedFileExtension;
docuValue.insert();
// Update DocuRef and DocuValue References
docuRef.ValueRecId = docuValue.RecId;
docuRef.update();
}
ttsCommit;
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.