Wednesday, June 18, 2014

Accessing a customers contact list through x++

So I working on something where I need to access a customer contacts list through x++ however I found out that the linkage between CustTable and LogisticsElectronicAddress is far and few between so I figured I would post how I was able to regenerate the contact list that is displayed on the CustTable form

The key is to go from CustTable -> DirPartyTable -> DirPartyLocation. Once you have this you need a combination of DirPartyTable and DirPartyLocation to go to LogisticsElectronicAddress

 
 static void findEmailAckTest(Args _args)
{
    CustTable custTable;
    DirPartyTable dirParty;
    LogisticsElectronicAddress electronicAddress;
    DirPartyLocation dirPartyLoc;
   
    //find the customer
    custTable = CustTable::find("21356");
    //find the party for the customer
    dirParty = DirPartyTable::findRec(custTable.Party);
   
    //find all of the contacts for the current customer
    while SELECT  * FROM electronicAddress
    EXISTS JOIN * FROM dirPartyLoc
    WHERE electronicAddress.Location == dirPartyLoc.Location && dirParty.RecId==dirPartyLoc.Party
    {
        info(electronicAddress.Locator);
    }
    
}

No comments:

Post a Comment