如何显示公司间客户的邮政地址?

时间:2016-07-23 02:46:13

标签: dynamics-ax-2012 x++

我想在字段SalesTable.IntercompanyOriginalCustAccount中为客户显示公司间交易中的直接交货地址。我可以获得客户记录,我需要显示该客户的地址。但是当我更改客户地址时,以下代码返回的地址为空。

display public LogisticsAddressing getAlamat()
{
    CustTable                   custTable;
    DirPartyTable               dirPartyTable;
    LogisticsPostalAddress      logisticsPostalAddress;
    LogisticsAddressing         alamat;
    CustAccount                 intercompanyCust = this.InterCompanyOriginalCustAccount;

    alamat = "";
    changeCompany('ma-d')
    {
        while select firstOnly custTable
                order by logisticsPostalAddress.RecId desc
                where intercompanyCust == custTable.AccountNum
            join dirPartyTable
                where dirPartyTable.RecId == custTable.Party
            join logisticsPostalAddress
                where logisticsPostalAddress.location == dirPartyTable.PrimaryAddressLocation
                   //&& logisticsPostalAddress.recVersion == 1
        {
            alamat=logisticsPostalAddress.Address;
        }
    }
    return alamat;
}

1 个答案:

答案 0 :(得分:1)

我不确定这是否符合您的要求,但请查看表postalAddress的{​​{1}}方法。使用此代码,您的代码可能如下所示:

CustTable