Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Postal Address for non party entity

Posted on by

How can I create a postal address for a non party enity like inventlocation?

*This post is locked for comments

  • Suggested answer
    Re: Postal Address for non party entity

    Now here is my solution.

      LogisticsEntityLocationMap   entityPartyLocationMap;

      container locationRoles, roles;

      LogisticsPostalAddressEntity logisticpostalentity;

      LogisticsPostalAddressView postalAddress;

       postalAddress.Street = 'Hauptstrasse';

       postalAddress.City = 'Treuen';

       postalAddress.State = '';

       postalAddress.ZipCode = '08233';

       postalAddress.CountryRegionId = 'DEU';

       postalAddress.LocationName = '1234';

       logisticpostalentity = new LogisticsPostalAddressEntity();

       address = logisticpostalentity.createPostalAddress(postalAddress);

       entityPartyLocationMap =   LogisticsEntityLocationMap::find(

                tableNum(InventLocationLogisticsLocation),

                InventLocation::find(_projid).RecId,address.Location);

       entityPartyLocationMap.Entity = InventLocation::find('1234').RecId;

       entityPartyLocationMap.Location = address.Location;

       entityPartyLocationMap.IsPostalAddress = NoYes::Yes;

       entityPartyLocationMap.IsPrimary = NoYes::No;

       entityPartyLocationMap.IsPrivate = NoYes::No;

       entityPartyLocationMap.ValidFrom = DateTimeUtil::utcNow();

       entityPartyLocationMap.ValidTo = DateTimeUtil::maxValue();

       LocationRoleMap = LogisticsLocationEntity::getDefaultLocationRoleFromEntity

                     (tableName2id("InventLocation"));

       locationRoles = map2Con(LocationRoleMap);

       roles = conpeek(locationRoles, 1);

       // create/update location entity and write roles

       entityPartyLocationMap.addEntityLocation(roles ,true);

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans