Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

to fetch delivery name & delivery postal address

(0) ShareShare
ReportReport
Posted on by

Hi team,

I have done below code to get the Delivery address and name but the delivery POSTAL address is NOT fetching properly.

LogisticsLocationRecId      locationRecId;
        
LogisticsLocationRole       role = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery);
        
LocationRecId   = LogisticsLocationDefault::findSimpleDefault(InventSite::find(this.InventSiteId), role).RecId;
LogisticsLocation location = LogisticsLocation::find(locationRecId);

this.DeliveryName =  InventLocation::find(this.InventLocationId).Name;
this.DeliveryPostalAddress = LogisticsPostalAddress::addressRecIdFromLocationRecId(location.RecId);

Kindly let me know where is the issue?

Pls give me more shed on this.

thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    Thanks Mohit for the sharing the below link

    https://wp.me/p9l6rY-1B

    My issue has been resolved.

    thanks bro

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    [ExtensionOf(tableStr(PurchTable))]
    final class PurchTableTbl_Extension
    {
       public void modifiedFieldWithUserInput(FieldId _fieldId, boolean _isFieldSetExplicitlyByUser)
        {
            VendTable                   vendTable;
            LogisticsLocationRecId      locationRecId;
    
            //LogisticsPostalAddress address = LogisticsLocationEntity::findPostalAddress(this.InventSiteId, LogisticsLocationRoleType::Delivery);
            
            
            LogisticsLocationRole       role = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery);
            
            locationRecId   = LogisticsLocationDefault::findSimpleDefault(InventSite::find(this.InventSiteId), role).RecId;
            LogisticsLocation location = LogisticsLocation::find(locationRecId);
            
    
            ttsbegin;
            select forupdate vendTable
                where vendTable.AccountNum == this.OrderAccount;
            if (vendTable)
            {
                vendTable.InventLocation    = this.InventLocationId;
                vendTable.InventSiteId      = this.InventSiteId;
    
                vendTable.doUpdate();
            }
            ttscommit;
    
            next modifiedFieldWithUserInput(_fieldId,_isFieldSetExplicitlyByUser);
            switch(_fieldId)
            {
                case fieldNum(PurchTable,OrderAccount) :
                    this.DeliveryName =  InventLocation::find(this.InventLocationId).Name;
                    
                    //this.DeliveryPostalAddress = LogisticsPostalAddress::addressRecIdFromLocationRecId(location.RecId);
    
                    this.DeliveryPostalAddress = LogisticsLocationEntity::constructFromLocationRecId
                        (InventLocation::getLocationFromRole(locationRecId,LogisticsLocationRoleType::Delivery)).getPostalAddress().RecId;
     
                    break;                
            }
        }
    }

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    thanks Mohit let me try this

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: to fetch delivery name & delivery postal address

    The above code is providing you table buffer of LogisticsPostalAddress and you need to map its RecId in DeliveryPostalAddress field, so please use below code

    this.DeliveryPostalAddress = LogisticsLocationEntity::constructFromLocationRecId(InventLocation::getLocationFromRole(inventLocation.RecId, LogisticsLocationRoleType:: Delivery)).getPostalAddress().RecId;

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    Hi Mohit,

    I tried with the code which you mentioned, got below error. It seems datatype issue.

    pastedimage1682743368778v1.png

    pls give me more shed on this.

    thanks!

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    Sure Mohit, I will let you know

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: to fetch delivery name & delivery postal address

    Hi, Please try this code

    this.DeliveryPostalAddress = LogisticsLocationEntity::constructFromLocationRecId(InventLocation::getLocationFromRole(inventLocation.RecId, LogisticsLocationRoleType:: Delivery)).getPostalAddress();

     https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/397195/get-warehouse-address-based-on-logistics-location-role-type 

    If any issues, in above code then try this and let us know your test results

    https://wp.me/p9l6rY-1B

  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: to fetch delivery name & delivery postal address

    Please debug your code to check why it is not working. I cannot comment on that directly by seeing it.

  • @rp@n Profile Picture
    @rp@n on at
    RE: to fetch delivery name & delivery postal address

    Kindly verify my code pls. where is wrong? and if yes , kindly suggest me what to do

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: to fetch delivery name & delivery postal address

    Hi, please use LogisticsPostalAddress asee tity and get the address from that. First give a SQL statement on that and you can see address in that. That will help you.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans