Tuesday, 18 October 2016

Select Statement Examples [AX 2012]

All of the following examples use the CustTable.

General Examples

The following X++ job shows several small examples of how you can use the select statement.
static void SelectRecordExamples3Job(Args _args)
{
    CustTable custTable;  // As of AX 2012.

    // A customer is found and returned in custTable
    select * from custTable;
    info("A: " + custTable.AccountNum);

    // A customer with account number > "100" is found
    select * from custTable
        where custTable.AccountNum > "100";
    info("B: " + custTable.AccountNum);

    // Customer with the lowest account number > "100" found:
    select * 
        from custTable 
            order by accountNum
                where custTable.AccountNum > "100";
    info("C1: " + custTable.AccountNum);

    // The next customer is read
    next custTable;
    info("C2: " + custTable.AccountNum);

    // Customer with higest account number
    // (greater than 100) found: Fourth Coffee
    select * 
        from custTable 
            order by accountNum desc
                where custTable.accountNum > "100";
    info("D1: " + custTable.AccountNum);
    
    // The next record is read (DESC): Fabrikam, Inc.
    next custTable; 
    info("D2: " + custTable.AccountNum);

    // Customer with highest account number found: Fourth Coffee
    select reverse custTable 
        order by accountNum;
    info("E: " + custTable.AccountNum);

    // Customer with "lowest" name and account number
    // in the interval 100 to 1000 is found. This is Coho Winery.
    select * 
        from custTable 
            order by DlvMode
                where custTable.accountNum > "100"
                    && custTable.accountNum < "1000";
    info("F: " + custTable.AccountNum);

    // The count select returns the number of customers.
    select count(AccountNum) 
        from custTable;
    // Prints the result of the count
    info(strFmt("G: %1 = Count of AccountNums", custTable.accountNum));

    // Returns the average credit max for non-blocked customers.
    select avg(CreditMax) 
        from custTable
            where custTable.blocked == CustVendorBlocked::No;
    // Prints the result of the avg
    info(strFmt("H: %1 = Average CreditMax", custTable.CreditMax));
}
/*** Display from infolog:
Message (02:00:34 pm)
A: 4000
B: 4000
C1: 4000
C2: 4001
D1: 4507
D2: 4506
E: 4507
F: 
G: 29 = Count of AccountNums
H: 103.45 = Average CreditMax
***/

Join Sample

This X++ code sample shows how an inner join can be performed as part of an SQL select statement.
The sample also shows an order by clause that has each field qualified by a table name. This enables you to control how the retrieved records are sorted by using only one order by clause.
static void SelectJoin22Job(Args _args)
{
    CustTable xrecCustTable;
    CashDisc xrecCashDisc;
    struct sut4;

    sut4 = new struct("str AccountNum; str CashDisc; str Description");

    while select firstOnly10 *
        from xrecCustTable
            order by xrecCashDisc.Description
                join xrecCashDisc
                    where xrecCustTable.CashDisc ==
                        xrecCashDisc.CashDiscCode
                        && xrecCashDisc.Description LIKE "*Days*"
    {
        sut4.value("AccountNum", xrecCustTable.AccountNum );
        sut4.value("CashDisc", xrecCashDisc.CashDiscCode );
        sut4.value("Description", xrecCashDisc.Description );

        info(sut4.toString());
    }
/*********  Actual Infolog output
Message (02:29:37 pm)
(AccountNum:"1101"; CashDisc:"0.5%D10"; Description:"0.5% 10 days")
(AccountNum:"4001"; CashDisc:"0.5%D10"; Description:"0.5% 10 days")
(AccountNum:"1102"; CashDisc:"0.5%D30"; Description:"0.5% 30 days")
(AccountNum:"1201"; CashDisc:"0.5%D30"; Description:"0.5% 30 days")
(AccountNum:"2211"; CashDisc:"0.5%D30"; Description:"0.5% 30 days")
(AccountNum:"1202"; CashDisc:"1%D15"; Description:"1% 15 days")
(AccountNum:"1203"; CashDisc:"1%D07"; Description:"1% 7 days")
(AccountNum:"2212"; CashDisc:"1%D07"; Description:"1% 7 days")
(AccountNum:"2213"; CashDisc:"1%D07"; Description:"1% 7 days")
(AccountNum:"2214"; CashDisc:"1%D07"; Description:"1% 7 days")
*********/
}

Group By and Order By

This X++ code sample shows that the fields in the group by clause can be qualified with a table name. There can be multiple group by clauses instead of just one. The fields can be qualified by table name in only one group by clause. Use of table name qualifiers is recommended.
The order by clause follows the same syntax patterns that group by follows. If provided, both clauses must appear after the join (or from) clause, and both must appear before the where clause that might exist on the same join. It is recommended that all group by and order by and whereclauses appear immediately after the last join clause.
static void SelectGroupBy66Job(Args _args)
{
    CustTable xrecCustTable;
    CashDisc xrecCashDisc;
    struct sut4;

    sut4 = new struct("str AccountNum_Count; str CashDisc; str Description");

    while select
        count(AccountNum)
        from xrecCustTable
            order by xrecCashDisc.Description
                join xrecCashDisc
        group by
            xrecCashDisc.CashDiscCode
                    where xrecCustTable.CashDisc ==
                        xrecCashDisc.CashDiscCode
                        && xrecCashDisc.Description LIKE "*Days*"
    {
        sut4.value("AccountNum_Count", xrecCustTable.AccountNum );
        sut4.value("CashDisc", xrecCashDisc.CashDiscCode );
        sut4.value("Description", xrecCashDisc.Description );

        info(sut4.toString());
    }
/*********  Actual Infolog output
Message (02:45:26 pm)
(AccountNum_Count:"2"; CashDisc:"0.5%D10"; Description:"")
(AccountNum_Count:"3"; CashDisc:"0.5%D30"; Description:"")
(AccountNum_Count:"4"; CashDisc:"1%D07"; Description:"")
(AccountNum_Count:"1"; CashDisc:"1%D15"; Description:"")
(AccountNum_Count:"1"; CashDisc:"2%D30"; Description:"")
(AccountNum_Count:"1"; CashDisc:"3%D10"; Description:"")
*********/
}

This X++ code sample shows how to count number of records in a table through an SQL select statement. I don't want to use while loop.
static void recordCountInInventTable(Args _args)
{
    InventTable     inventTable;
    
    select count(RecId) from inventTable
        where inventTable.NameAlias != "Obsolete"
        &&    inventTable.NameAlias != "Use to Depletion"
        &&    inventTable.FSProductApprovalStatus == FSProductApprovalStatus::Approved;
    //return inventTable.RecId;
    info(strFmt('%1', inventTable.RecId));
}

Or

/// <summary> /// Get resource poool count. /// </summary> /// <returns> /// resource pool count. /// </returns> protected int getResourcePoolCount() { select count(Rank) from resourceTable where resourceTable.UserSession == _userSession && resourceTable.ResourceSet == ProjResourceSet::Pool;
return resourceTable.Rank; }

Happy DAXing...

How to Open a table in AX 2012 through X++ code

Opening the table from x++ code

This code helps you to open the any Table from X++ code. Here is an example for SalesTable, just copy and paste this into a job you will get the table.

static void TableBrowser(Args _args)
{
     SysTableBrowser sysTableBrowser = new SysTableBrowser();

    //Browse the SalesTable table
   sysTableBrowser.run(tablenum(SalesTable ));
}



How to open a form by using AX code

In the shortest example, all it takes is one line of code.

new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run();

The above code will open the CustTable form. That's all it takes, it's that simple.
Now if you want to supply some arguments to the opening form, this is also possible with the optional args parameter.
Like this for example:

static void OpenFormByCodeA()
{ Args args = new Args();
 
args.record(CustTable::find('ABC'));
new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run(Args);
}

This code will open the CustTable form and filter out the customer with accountnumber ABC.
Use the args methods like parm and parmEnum to provide your target form with more data.

If you want even more control on opening the form from code, this is also possible.
This next example gives the same result as the previous one.

static void OpenFormByCodeB()
FormRun formRun;
Args args = new Args();

args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}


Now if we tweak this a little bit, we can add our code
Like this:

static void OpenFormByCodeB()
Object formRun;
Args args = new Args();

args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();

formRun.yourmethodgoeshere(); /* !!

formRun.run();
formRun.wait();
}

Happy DAXing...

How to Open a table in AX 2012 through X++ code

Opening the table from x++ code

This code helps you to open the any Table from X++ code. Here is an example for SalesTable, just copy and paste this into a job you will get the table.

static void TableBrowser(Args _args)
{
     SysTableBrowser sysTableBrowser = new SysTableBrowser();

    //Browse the SalesTable table
   sysTableBrowser.run(tablenum(SalesTable ));
}



How to open a form by using AX code

In the shortest example, all it takes is one line of code.

new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run();

The above code will open the CustTable form. That's all it takes, it's that simple.
Now if you want to supply some arguments to the opening form, this is also possible with the optional args parameter.
Like this for example:

static void OpenFormByCodeA()
{ Args args = new Args();
 
args.record(CustTable::find('ABC'));
new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run(Args);
}

This code will open the CustTable form and filter out the customer with accountnumber ABC.
Use the args methods like parm and parmEnum to provide your target form with more data.

If you want even more control on opening the form from code, this is also possible.
This next example gives the same result as the previous one.

static void OpenFormByCodeB()
FormRun formRun;
Args args = new Args();

args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}


Now if we tweak this a little bit, we can add our code
Like this:

static void OpenFormByCodeB()
Object formRun;
Args args = new Args();

args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();

formRun.yourmethodgoeshere(); /* !!

formRun.run();
formRun.wait();
}

Happy DAXing...

Friday, 14 October 2016

Export Obsolete Material from AX to Excel

static void ExportObsoluteItemIntoExcel(Args _args)
{

EcoResProduct ecoResProduct;
 
//EcoResProductMaster ecoResProductMaster;


InventTable inventTable;

SysExcelApplication application;

SysExcelWorkbooks workbooks;

SysExcelWorkbook workbook;

SysExcelWorksheets worksheets;

SysExcelWorksheet worksheet;

SysExcelCells cells;

SysExcelCell cell;

SysExcelFont font;

int row = 1;


application = SysExcelApplication::construct();

workbooks = application.workbooks();

workbook = workbooks.add();

worksheets = workbook.worksheets();

worksheet = worksheets.itemFromNum(1);

cells = worksheet.cells(); 
cells.range('A:A').numberFormat('@');

// Setting Header values

/*cell = cells.item(1, 1);

cell.value("Item number");

font = cell.font();

font.bold(true);*/

cells.item(1, 1).value("Item number");

cells.item(1, 1).font().bold(true);

cells.item(1, 2).value("Search name");

cells.item(1, 2).font().bold(true);

cells.item(1, 3).value("Item name");

cells.item(1, 3).font().bold(true);

while select ecoResProduct

where ecoResProduct.SearchName == "Obsolete"

|| ecoResProduct.SearchName == "Use to Depletion"
{
row++;
/*cell = cells.item(row, 1);
cell.value(ecoResProduct.DisplayProductNumber);*/ cells.item(row, 1).value(ecoResProduct.DisplayProductNumber);

cells.item(row, 2).value(ecoResProduct.SearchName);

cells.item(row, 3).value(ecoResProduct.productName());
}application.visible(true);
}

Friday, 22 July 2016

To add the AOS service account to the debug group

Microsoft Dynamics AX Debugging Users group

Hi,
Here we will talk about Debugging users group issue.
Suppose, if you are working with a new instance in a new machine and once you do debugging you will get an error "The X++ debugger works only for users who are in the 'Microsoft Dynamics AX Debugging users' local group of windows. Get added to the group, then login again to the windows."
For fixing this issue, we need to do some kind of setup. which are as:

  1. From the Start menu, point to All Programs, click Administrative Tools, click Computer Management, and then click Local Users and Groups.
  2. In Local Users and Groups, double-click Groups, right-click Microsoft Dynamics AX Debugging Users and click Add to Group.

Detailed:

If you see this when you expected to see the debugger:


  1. Go to Control Panel -> System and Security -> Administrative tools -> Computer Management
    (To find it quickly, press the windows key on the keyboard and start typing “Computer Management”)
  2. Click on Local Users and Groups -> Groups. In the middle pane, Click on “Microsoft Dynamics AX Debugging Users”.
  3. Click on the Add button. (Users that are already added are displayed in the members block. Mine are blacked out for privacy.)
  4. In the dialog, enter the name of the user you want to add to the Microsoft Dynamics AX Debugging Users group and click on OK.
  5. Sign out and back into the Windows account.
It is possible that only the admin has rights to add users to the Microsoft Dynamics AX Debugging Users group. In that case you will have to log in with the admin account or ask the administrator to complete these steps for you.

Happy DAXing...

How to Convert Ledger dimension into Default dimension

Display Main account from LedgerDimension and convert Ledgerdimension into Defaultdimension:

Hi,
Here We will talk, how to display MainAccountId from LedgerDimension and second, how to convert LedgerDimension into DefaultDimension so that we can display financial dimensions separately....
Code will be like:
Example-1: Suppose we need to display MainAccountId from Purchase requisition detail form/Purchase requisition lines/ Financials/ Distribution amounts (AccountingDistribution table) to Purchase requisition line grid (PurchReqLine table) then code will be like...

//created by v-vimsin on 18th July 2016
//BP deviation documented
display public MainAccountNum MSDisplayLedgerDim()
{
    PurchReqTable           purchReqTableLoc;
    AccountingDistribution  accountingDistributionLoc;

    purchReqTableLoc = PurchReqTable::find(this.PurchReqTable);

    select RecId,SourceDocumentHeader,SourceDocumentLine,LedgerDimension from accountingDistributionLoc
        where  purchReqTableLoc.SourceDocumentHeader    == accountingDistributionLoc.SourceDocumentHeader
            && this.SourceDocumentLine                  == accountingDistributionLoc.SourceDocumentLine;

    return MainAccount::find(DimensionStorage::getMainAccountIdFromLedgerDimension(accountingDistributionLoc.LedgerDimension)).MainAccountId;

}


Example-1: Suppose we need to display Cost center from Purchase requisition detail form/Purchase requisition lines/ Financials/ Distribution amounts (AccountingDistribution table) to Purchase requisition line grid (PurchReqLine table) then we will convert LedgerDimension to DefaultDimension first and then return Cost center. Code will be like...

//created by v-vimsin on 18th July 2016
//BP deviation documented
display public DimensionValue MSDisplayCostCenter()
{
    PurchReqTable                   purchReqTableLoc;
    DimensionDefault                defaultdimension;
    AccountingDistribution          accountingDistributionLoc;
    DimensionAttribute              DimensionAttributeLoc;
    DimensionAttributeValue         DimensionAttributeValueLoc;
    DimensionAttributeValueSetItem  DimAttrValueSetItemLoc;

    purchReqTableLoc = PurchReqTable::find(this.PurchReqTable);

    select RecId,SourceDocumentHeader,SourceDocumentLine,LedgerDimension from accountingDistributionLoc
        where  purchReqTableLoc.SourceDocumentHeader    == accountingDistributionLoc.SourceDocumentHeader
            && this.SourceDocumentLine                  == accountingDistributionLoc.SourceDocumentLine;

    defaultdimension =  Dimensionstorage::GetDefaultDimensionfromLedgerDimension(accountingDistributionLoc.LedgerDimension);

    select RecId,Name from DimensionAttributeLoc
        join RecId,DimensionAttribute from DimensionAttributeValueLoc
        join DimAttrValueSetItemLoc
            where DimensionAttributeValueLoc.DimensionAttribute == DimensionAttributeLoc.RecId
                && DimAttrValueSetItemLoc.DimensionAttributeValue == DimensionAttributeValueLoc.RecId
                && DimAttrValueSetItemLoc.DimensionAttributeValueSet == defaultdimension
                && DimensionAttributeLoc.Name == "@SYS343410";
    return DimAttrValueSetItemLoc.DisplayValue;
}


For this time that's it.

Happy DAXing....

Monday, 20 June 2016

How to update SID, Network domain and Network alias after restoring new DB in AX

Issue "Failed to logon to Microsoft Dynamics AX" after restoring demo/ other network domain data into SQL 

Here, We will discuss about the issue "Failed to logon to Microsoft Dynamics AX". 
Generally when we install new AOS then "MicrosoftDynamicsAX" is our default database and after synchronization/compilation we can access our AOS instance. After completing this approach we need data to start practice or work. 
So I would recommend to create new database (suppose "MsDyDemo") in your SSMS instead of overwriting over your default DB. What I mean to say, don't touch your default database (MicrosoftDynamicsAX). Now restore demo data or other network domain's data into your newly created database "MsDyDemo" and go to: Administrative tools/Microsoft Dynamics AX 2012 Server Configuration/Database connection (tab). Select "MsDyDemo" under Database name drop down and restart AOS services. Once AOS services is running then you need to access Ms Dy AX but you will get info message "Failed to logon to Microsoft Dynamics AX" in case your system domain and restored DB domain are different.

Here, for fixing this issue we need to change SID, Network domain and Alias from restored DB "MsDyDemo" so first select your default DB "MicrosoftDynamicsAX" and run SQL query 
select * from USERINFO
execute this query and select user- "Admin". Copy SID, Network domain from Admin user and save in separate Note pad or Word document. 



Now select and expand database "MsDyDemo", expand tables and select dbo.UserInfo. Right click on table dbo.UserInfo and select "Edit Top 200 Rows". 

Select User- Admin and update SID, Network domain values from Note pad or Word document (the values which we copied from default DB) and give your current user account name under NetworkAlias. Save the changes and run AOS with admin credential. Once AX gets open then go to: Systemadministration/Common/Users/Users/Import other user accounts.

I hope I cleared the concept.

Happy DAXing..... 

Update SID through SQL query

Update SID after restoring DB into AX

UPDATE USERINFO SET SID = '', NETWORKALIAS = '', NETWORKDOMAIN = '', NAME = ''


UPDATE SYSBCPROXYUSERACCOUNT SET SID = '', NETWORKALIAS = '', NETWORKDOMAIN = ''


UPDATE SYSUSERINFO SET SQMUSERGUID = '00000000-0000-0000-0000-000000000000'


DELETE FROM SYSSERVERCONFIG
DELETE FROM SYSSERVERSESSIONS
DELETE FROM SYSCLIENTSESSIONS
DELETE FROM SRSSERVERS
DELETE FROM BATCHSERVERCONFIG
DELETE FROM BATCHSERVERGROUP
DELETE FROM SYSUSERLOG
DELETE FROM BICONFIGURATION
DELETE FROM BIANALYSISSERVER
DELETE FROM SMMPHONEPARAMETERS
DELETE FROM EPGlobalParameters
DELETE FROM EPWebSiteParameters

Monday, 25 April 2016

Configure document management [AX 2012] Error: while doing attachment "Document management dictionary does not exist"

Configure document management [AX 2012]

Updated: July 7, 2014
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2
This topic explains how to configure document management for the first time. You can use document management, also known as document handling, to attach notes, documents, or document references to records. You can also use Office Add-ins for Microsoft Dynamics AX to integrate with document management and create Microsoft Word and Microsoft Excel documents or document templates that use Microsoft Dynamics AX data.
The following illustration shows how to configure document management. The numbers correspond to the procedures later in this topic.
The configure document management process

1. Activate document management
Before you can attach documents to records or generate documents from a record, you must activate the document management functionality and then you must activate document management for specific tables.
To activate document management, follow these steps:
  • Click File > Tools > Options. 
  • In the General area, expand the Miscellaneous FastTab.  
  • In the Document handling field group, select the Document handling active check box.
To activate document management for specific tables, follow these steps:
  • Click Organization administration > Setup > Document management > Active document tables. 
  • Click New. 
  • Select the name of the table to activate document management for.  
  • Example: To activate document management for sales orders, select the SalesTable table name.
  • Repeat steps 2 and 3 for each table that you want to activate document management for.

When you attach a document to a record in Microsoft Dynamics AX, it is stored in a location that you specify. This location is called an archive directory. You can specify one archive directory for all the document types you set up, or you can specify a separate archive directory for each document type. If you don’t specify an archive directory for a document type, the document type uses the archive directory that you specify in this procedure. See “Create or import document types” later in this topic for more information about how to specify an archive directory for a document type.
NoteNote
If you use Enterprise Portal for Microsoft Dynamics AX, there are additional requirements and restrictions about document archives. For more information, see Set up documents for viewing in Enterprise Portal.
To specify a location for the Microsoft Dynamics AX document archive directory, follow these steps:
  • Click Organization administration > Setup > Document management > Document management parameters.
  • In the General area, browse to the location of the archive directory.
    Caution noteCaution
    If you already have an archive directory specified and you want to change it, you first must move the contents of the existing archive directory to the new archive directory. For more information, see Document management.
  • Optional: Specify the maximum file size that is allowed for documents.
    Field Description
    Max. file size in database Enter the maximum file size, in megabytes, for a file that is saved to the Microsoft Dynamics AX database.
    Max. file size in file system Enter the maximum file size, in megabytes, for a file that is saved to the archive directory location.

Before you can use document management, you must specify number sequences for documents. The files that you attach to records are renamed when they are stored in the archive directory. The file name of the attached files is determined by the number sequences that you set up for documents.
To specify number sequences for documents, follow these steps:
  • Click Organization administration > Setup > Document management > Document management parameters.
  • In the Number sequences area, select a number sequence code for each reference. If the number sequence code that you’re looking for is not listed, you must create a new number sequence code in the Number sequences list page. For more information, see Set up number sequences.

You can control which types of files, or documents that have specific file name extensions, that users can attach to Microsoft Dynamics AX records.
To specify file types, follow these steps:
  • Click Organization administration > Setup > Document management > Document management parameters.
  • In the File types area, review the default file types. Remove the file types that users should not be able to attach to records, and add any additional file types that users should be able to attach to records.

When you use document management, you can integrate with Office Add-ins to create Word documents and Excel workbooks that are linked dynamically to the tables in Microsoft Dynamics AX. For specific instructions about how to do this, see Install Office Add-ins and Set up integration with Microsoft Office Add-ins.

Document types are required for document management and are used to categorize the documents that you attach to records. When you create an unattached document, one of these content types is assigned to it. If you have workflows set up, workflow uses the document type to route the document to the appropriate user or work-item queue.
The Note and File document types are available by default.

To create a document type, follow these steps:
  • Click Organization administration > Setup > Document management > Document types.
  • Click New, and then enter the following information about the document type.
    Field Description
    Class Select the action that occurs when a user creates an attachment of the selected document type:
    • Attach URL – Attach a reference to a document by using a URL.
    • Create a Microsoft Excel worksheet by using COM – Create an Excel worksheet and copy data from the selected transaction.
    • Create a Microsoft Word document by using COM – Create a Word document and copy data from the selected transaction.
    • Create application document – Create a Word document without opening Word.
    • Simple note – Create a simple note for the referenced transaction.
    • Template library – Create a template file by using Word or Excel, and then save the file to a template library. For example, you can create a budget template by using Excel. Each department in your organization then enters budget information in a copy of the template.
      NoteNote
      Your system administrator must create the site or SharePoint document library for the template library.
    Group Select the group for the document type.
    Auto-save Select this check box to automatically save temporary files to the database after you use them.
    Typically, temporary files are stored in the Temp folder in Microsoft Windows. To save temporary files in the directory that is specified in the File location list, select Auto-save.
    Autodelete Select this check box to automatically delete temporary files after you use them.
    Typically, temporary files are stored in the Temp folder in Windows.
    Remove Select Document only to remove only the reference to the document file or select Document and physical file to remove both the reference and the physical file.
    Ask for confirmation Select this check box to require confirmation before the physical file is deleted.
    Category Select an Enterprise Portal document category to associate with the document type.
    Details for document categories are set up in the Enterprise Portal parameters form. For more information, see Attach documents, notes, or URLs to records.
    Archive directory The directory where document files of the selected document type are stored.
    If this field is empty, the default archive directory that is specified in the Document management parameters form is used as the archive directory.
    NoteNote
    If you use Enterprise Portal, there are additional requirements and restrictions about document archives. For more information, see Set up documents for viewing in Enterprise Portal.
    Location Select the location where document files for this content type are stored. The following options are available:
    • Archive directory – Documents of this type are stored in the directory that is specified in the Archive directory field.
    • Database – Documents of this type are stored in the Microsoft Dynamics AX database.
    • Original location – Documents of this type are stored in the location that was used when the file was originally attached to the record.
    • SharePoint – Documents of this type are stored in a SharePoint document library.
    NoteNote
    If documents are stored in a shared location instead of the database, verify that the correct access level is set for the shared location.
    Check table If this check box is selected, the selected document type is available only from the tables that are specified in the Options form.
    By default, the check box is cleared for the standard document types, Note and File.
    For more information, see Restrict a document type to a specific table.

To import document types, follow these steps:
  • Click Organization administration > Setup > Document management > Document types.
  • Click Import.
  • Browse to the location of the file that contains the exported document types.
  • When prompted to delete tables before you import, click Yes to all, and then click OK.
  • Click Yes to confirm.

Content types are used to categorize documents that are not attached to records. Examples of unattached documents might be invoices, expense reports, or purchase orders. Workflow uses document content types to route documents to the correct user or work-item queue for processing. For more information, see Configuring the workflow system.
To create content types, follow these steps:

  1. Click Organization administration > Setup > Document management > Document content types.
  2. Click New, and then enter a name and a description for the content type.
For more information, see Document content types (form).

Before you can use Application Integration Framework (AIF) document services, you must specify document management settings for AIF. AIF document services are query-based services that you can use to exchange data with external systems by sending and receiving XML documents. These documents represent business entities, such as customers, vendors, or sales orders. To specify document management settings for AIF, follow these steps:

  1. Click Organization administration > Setup > Document management > Document management parameters.
  2. Click AIF.
  3. Complete the following fields.
Field Description
Document type: Select the document type for notes in incoming electronic documents. For sales orders, this type must be Note.
Document file service Select this check box if the web service document files should be submitted to workflow for routing to appropriate parties.
For more information, see AIF Document Services

Error: Document management dictionary does not exist

For Example: In AX 2012 I am trying to attach or upload file, then I am facing an error i.e.
"Document management dictionary does not exist"

Solution:
  • Organization administration > Setup > Document management > Document management parameters, specify the default archive directory..
  • Organization administration > Setup > Document management > Document types, select the specific document type and specify the archive directory.
For Example: I am also getting the issue while changing the Product image and did the same exercise, but no use..!! And my archive directory is already selected but still m getting the same issue. Kindly advise.

Solution:
Document Management Parameters: Select and copy an Archive Directory path
Document types: click create new, for example Image and select also Image as the "Group" on the right hand of the form.
You'll find the forms here: Organization administration > Setup > Document management
After that I was able to attach an item under Product information management/Common/Released products > "Product tab" - Product Image
 

Happy DAXing....