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

Notifications

Announcements

No record found.

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,361 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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans