web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Code to get delivery address for direct delivery

(0) ShareShare
ReportReport
Posted on by

i want to get delivery address for direct delivery, but the code i create seems doesnt working if i change the delivery address from the customer. it cant show the current address of the customer. the field always go blank if i tried to change customer address.

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;
    
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: need help with code

    Hey Kennelung,

    If you want to get customer delivery address you can use next method

    custTable.mcrDefaultDeliveryPostalAddress()

  • Community Member Profile Picture
    on at
    RE: Code to get delivery address for direct delivery

    Hi Ievgen Miroshnikov,

    Thanks for your response, but i cant find custTable.mcrDefaultDeliveryPostalAddress()

    just to make it clear, i need to get cust address from different company.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Code to get delivery address for direct delivery

    Hi Kennelung,

    If you are able to get customer in that company you can try to use this code (i just copied it from method I mentioned):

    LogisticsLocationEntity location = LogisticsLocationEntity::constructFromLocationRecId(
    LogisticsLocationDefault::findSimpleDefaultByRoleType(custTable, LogisticsLocationRoleType::Delivery).RecId); return location.getPostalAddress();


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans