End of mainstream support for Microsoft Dynamics AX 2009, 2012, and 2012Mainstream support for Dynamics AX 2009 Service Pack 1 (SP1), Dynamics AX 2012, and Dynamics AX 2012 R2 ended Oct. 9, 2018. After that date, only security hotfixes will be provided for these three versions through the extended support period that until Oct. 12, 2021. Read more
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
I use Microsoft Dynamic AX 2012R3
I create a function to get primary address of customer
Here is my code
public String255 getPrimaryAddress(AccountNum _accountNum)
custTable = custTable::find(_accountNum);
dirPartyTable = DirPartyTable::findRec(custTable.Party);
dirPartyLocation = DirPartyLocation::findPrimaryPartyLocation(dirPartyTable.RecId);
logisticsLocation = LogisticsLocation::find(dirPartyLocation.Location);
postalAddressView = DirPartyPostalAddressView::find(dirPartyTable.RecId,logisticsLocation.RecId);
And this is an example of address I get
As we can see, the bottom of address I can get short name of country
How to make it full name country?
Thanks in advance
What is your country short name and translation parameters?
This will always return Country code instead of Name. If you check DirPartyPostalAddressView it is using LogdticsPostaladdressView.
Check LogdticsPostaladdressView.FormatAddress() method you will get more details
Just to correct about formatAddress() method.
This method on LogisticPostalAddress table. And take a look at this piece of code:
case LogisticsAddressElement::CountryRegion :
saveLogisticsAddress += countryRegionTranslation.ShortName + #Separators;
select firstonly Language from userInfo where userInfo.Id == curUserId()
where countryRegionTranslation.CountryRegionId == countryRegion.CountryRegionId &&
countryRegionTranslation.LanguageId == userInfo.Language;
saveLogisticsAddress += (logisticsAddressFormatLinesFieldList.Expand && countryRegionTranslation.LongName ?
countryRegion.CountryRegionId)) + #Separators;
saveLogisticsAddress += ((logisticsAddressFormatLinesFieldList.Expand) ? #CountryRegionToken : _countryRegion) + #Separators;
As you can see, for Russian functionality the ShortName is used. You may create the same for your case.
Hi Tahta Bintang Pratama!
Did you solve the issue?
Hi Rustem Galiamov,
Sorry for late reply
I'm still try to understanding the code
I have checked the method formatAddress() and change it.
But, I saw that even if you commenting all those lines inside LogisticsAddressElement::CountryRegion case, it doesn't affect how DirPartyPostalAddressView::find() function retrieve the address.
If you go to the Address parameters form, you can manage address formats. On the line of the Country/Region, you can enable the 'Expand' option. When this is enabled, all new addresses from the country related to this address format, will then have the full name.
Hi André Arnaud de Calavon,
Where is the 'Expand' option location? I can't find it
I have find the Expand option, and I check it
But doesn't change the country on address
Is it need to restart AOS service?
Like mentioned, it will format it when you create new/edit addresses. Existing addresses needs to be updated, e.g. with a script.
I succeed to update address with full country name check all expand option to Country/Region address format
And then I update all address using batch job processing from this thread
Thank you for your help
Business Applications communities