Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The global address book does not contain the addresses of customers and the addresses of vendors even though you import all customer data to the CustTable table and import all vendor data to the VendTable table in Microsoft Dynamics AX 2009


Symptoms

In Microsoft Dynamics AX 2009, you import all customer data to the CustTable table and you import all vendor data to the VendTable table. However, the global address book does not contain the addresses of the customers and the addresses of the vendors.


Note The global address book is new feature in Microsoft Dynamics AX 2009.

↑ Back to the top


Cause

This problem occurs because the Dir* tables are not initialized automatically when you import the data to the CustTable table and to the VendTable table.

↑ Back to the top


Resolution

To resolve this problem, follow these steps:
  1. Use the Microsoft Dynamics AX import tool to import all data to the CustTable table and the VendTable table.
  2. Run the following job to create the missing address entries for the VendTable table:

    // ---code begin-----
    // The job is used to create the missing address entries for the VendTable table.
    static void generateDirPartyEntriesVendTable(Args _args)
    {
    VendTable vendTable;
    VendTable vendTableNoLock;
    ;
    while select vendTableNoLock
    {
    setPrefix(strFmt("Vendor %1",vendTableNoLock.AccountNum));
    try
    {
    ttsBegin;
    vendTable = VendTable::find(vendTableNoLock.AccountNum,true);
    if (vendTable)
    {
    if (vendTable.PartyId && !DirPartyTable::exist(vendTable.PartyId))
    {
    vendTable.PartyId = "";
    }
    if (!vendTable.PartyId)
    {
    // Create a Party entry for a vendor.
    vendTable.PartyId = DirParty::createPartyFromCommon(vendTable).PartyId;
    }
    else
    {
    DirParty::updatePartyFromCommonInsert(vendTable.PartyId,vendTable);
    }
    vendTable.update();
    }
    ttsCommit;
    }
    catch
    {
    error(strFmt("There has been an error while updating the vendor '%1'.",vendTableNoLock.AccountNum));
    }
    }
    }
    // ---code end-----
  3. Run the following job to create the missing address entries for the CustTable table:
    // ---code begin---
    // The job is used to create the missing address entries for the CustTable table.

    static void generateDirPartyEntriesCustTable(Args _args)
    {
    CustTable custTable;
    CustTable custTableNoLock;
    ;
    while select custTableNoLock
    {
    setPrefix(strFmt("Customer %1",custTableNoLock.AccountNum));
    try
    {
    ttsBegin;
    custTable = CustTable::find(custTableNoLock.AccountNum,true);
    if (custTable)
    {
    if (custTable.PartyId && !DirPartyTable::exist(custTable.PartyId))
    {
    custTable.PartyId = "";
    }
    if (!custTable.PartyId)
    {
    // Create a Party entry for a customer.
    custTable.PartyId = DirParty::createPartyFromCommon(custTable).PartyId;
    }
    else
    {
    DirParty::updatePartyFromCommonInsert(custTable.PartyId,custTable);
    }
    custTable.update();
    }
    ttsCommit;
    }
    catch
    {
    error(strFmt("There has been an error while updating the customer '%1'.",custTableNoLock.AccountNum));
    }
    }
    }
    // ---code end-----
Note Both jobs run the code of the custTable.insert method and the vendTable.insert method to create the Global Address Book entries.

↑ Back to the top


Keywords: kbmbsadministration, kbsurveynew, kbtshoot, kbprb, kbmbsquickpub, kbmbspartner, kbexpertisebeginner, kbmbsmigrate, kbexpertiseinter, kb

↑ Back to the top

Article Info
Article ID : 960368
Revision : 1
Created on : 1/7/2017
Published on : 8/3/2011
Exists online : False
Views : 53