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 :
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)
  • Rhushikesh R Profile Picture
    758 on at
    RE: Create or Update Customer Address through code X++ in D365 F&O

    Thanks Will for prompt response.

  • Verified answer
    WillWU Profile Picture
    22,359 on at
    RE: Create or Update Customer Address through code X++ in D365 F&O

    Hi Rhushikesh,

    Please try to add:

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

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 708 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 589 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 553

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans