Axapta 如何从custtable中查找国家的短名称

Axapta 如何从custtable中查找国家的短名称,axapta,x++,dynamics-ax-2012-r2,Axapta,X++,Dynamics Ax 2012 R2,我需要根据custtable查询国家名称的短名称 我知道信息就在这里 LogisticsAddressCountryRegionTranslation.shortname; LogisticsAddressCountryRegion.countryregionid; 问题是,通过这些关系,我看不到一种链接回custtable的方法。custtable中曾经有一个countryregionid可以链接回来,但是它被更改为DEL_countryregionid,不能再使用它了。 我怎样才能获得这

我需要根据custtable查询国家名称的短名称

我知道信息就在这里

LogisticsAddressCountryRegionTranslation.shortname;
 LogisticsAddressCountryRegion.countryregionid;
问题是,通过这些关系,我看不到一种链接回custtable的方法。custtable中曾经有一个countryregionid可以链接回来,但是它被更改为DEL_countryregionid,不能再使用它了。
我怎样才能获得这些信息。使用ax 2012时,需要注意的一点是,客户记录可以有多个地址。因此,此答案使用主邮政地址。这可能不是您的用例

此外,“短名”是特定于地区的

static void Job20(Args _args)
{
    CustTable                                   custTable;
    LogisticsAddressCountryRegionTranslation    countryRegionTranslation;
    UserInfo                                    userInfo;
    LogisticsAddressCountryRegion               countryRegion;
    LogisticsPostalAddress                      postalAddress;

    select firstOnly custTable;

    postalAddress = custTable.postalAddress();

    countryRegion   = LogisticsAddressCountryRegion::find(postalAddress.CountryRegionId);

    select firstonly Language from userInfo where userInfo.Id == curUserId()
        join countryRegionTranslation
            where countryRegionTranslation.CountryRegionId == countryRegion.CountryRegionId &&
                    countryRegionTranslation.LanguageId      == userInfo.Language;

    info(strFmt("Address: %1; ShortName: %2", postalAddress.Address, countryRegionTranslation.ShortName));
}