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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Create or Update Customer Address through code X++ in D365 F&O

(0) ShareShare
ReportReport
Posted on by 758

Hi Everyone,

With below code I am able to create address on Customer. But I want to  set the Purpose as well.

Can anyone help me to modify my code? How can I pass parameter for setting purpose of Address that is, Business/Delivery/Invoice .. etc.

 private void createAddress(SIAddressParameter			_address,
                              SICustomerAddressParameter	_custAddressParam,
                              CustTable						custTable)
    {
        dirPartyPostalAddressView     dirPartyPostalAddressView;
        DirParty                      dirparty;

        dirParty = DirParty::constructFromCommon(custTable);
   
        dirPartyPostalAddressView.LocationName          = _address.parmAddlocationName();
        dirPartyPostalAddressView.City                  = _address.parmCity();
        dirPartyPostalAddressView.Street                = _address.parmStreet();
        dirPartyPostalAddressView.CountryRegionId       = _address.parmCountryId();
        dirPartyPostalAddressView.State                 = _address.parmState();
        dirPartyPostalAddressView.zipcode               = _address.parmZipCode();
        dirPartyPostalAddressView.IsPrimary             = (_address.parmShipto())?NoYes::Yes:NoYes::No;
        dirPartyPostalAddressView.FSWithinCityLimits    = (_address.parmWithinCity() == 'Yes')?NoYes::Yes:NoYes::No;
        dirPartyPostalAddressView.FSYearBuilt           = _address.parmYearBuilt();
        dirPartyPostalAddressView.FSLeadPaintStatusId   = _address.parmLeadPaintStatusId();
        dirPartyPostalAddressView.CHI_CRMAddressId      = _address.parmCRMAddressId();
  
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,str2con(_address.parmAddRoles()));
    }

Add01.png

I have the same question (0)
  • Verified answer
    WillWU Profile Picture
    22,363 on at

    Hi Rhushikesh,

    Please try to add:

    container roles;
    roles = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Invoice).RecId;
    dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView, roles);

  • Rhushikesh R Profile Picture
    758 on at

    Thanks Will for prompt response.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 577 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans