I've been presented a requirement where the client only wants printed addresses to include the country/region ID if said country/region ID is different from the country/region ID of the primary address for the current legal entity in which the current user is working. This feels like a sufficiently 'obvious' request that I'm hoping it may be covered somewhere in standard AX, but I can't see anything in the Organisation administration > Setup > Addresses > Address setup or Organisation administration > Setup > Global address book > Global address book parameters forms that might fit the bill.
My first thought was to modify the LogisticsPostalAddress::formatAddress method to implement this as a customisation, but given that addresses aren't specific to a company/DataArea, that simply doesn't make sense. Additionally, it makes me more certain that this probably isn't a standard piece of functionality. Hence, can anyone think of a smarter way to do this than adding a new public static method to the LogisticsPostalAddress table (i.e. formatAddressForInternationalMail) that's pretty similar to formatAddress, but conditionally includes the country/region ID?
*This post is locked for comments
Thanks André. Creating a new column in the table for [DomesticAddress] and leaving the existing [Address] column as is will probably be how I approach this. That way, the LogisticsAddressFormatProcess::run method will still work with the address formats as configured in standard functionality: I'll just have to customise the class to populate the [DomesticAddress] as per [Address], with the exclusion of Country/RegionID. Whilst this will require a check every time the print address is requested, a helper method for that to compare the address country to the current company country should make everything relatively neat in terms of abstraction.
Hi Rich,
You can try to create a runtime function to remove the Country part or do new format of the complete address in case the address is within the same country as the current legal entity. Before going into this you need to be aware that this will have a minor performance penalty. When it comes to large number of addresses that needs to be used in some process, another approach like creating a new combined address field for internal country might be quicker. But also here a statement is required to determine if the standard address field or the new field must be used.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156