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, ...
Suggested Answer

Importing address for the customer using standard data entity

(0) ShareShare
ReportReport
Posted on by 439

Hi All,

I have a customer and want to add the address for the particular  customer and I am using  data entity it works fine for the below code when I use the below code in a unable class

 

CustomerPostalAddressEntity CustomerPostalAddressEntity;


        CustomerPostalAddressEntity.CustomerAccountNumber = "testcustaccount1";
        CustomerPostalAddressEntity.AddressDescription = "test address";
        CustomerPostalAddressEntity.AddressCountryRegionISOCode = "SGP";
        CustomerPostalAddressEntity.Effective = today();
        CustomerPostalAddressEntity.Expiration = dateMax();
        CustomerPostalAddressEntity.CustomerLegalEntityId = "TE";
        CustomerPostalAddressEntity.AddressZipCode = "050004";
        CustomerPostalAddressEntity.IsPrimary = NoYes::No;
        CustomerPostalAddressEntity.AddressDefaultRoles = "Business";
        CustomerPostalAddressEntity.insert();

      

How ever when I change the CustomerPostalAddressEntity.AddressDefaultRoles = "Delivery";

This gives an error 

"Role is not associated with a party and location "

Please help me out on this.

I have the same question (0)
  • rohit1900 Profile Picture
    439 on at

    its working fine when i add the address from the front end....

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Rohit1900,

    Have you checked if the value exists in the "Address and contact information purpose" form? Are you creating new records? Is it updating records? Is another role like 'Home' working?

    Eventually, you can use the debugger to find out what it causing this error.

  • Suggested answer
    ThomasWilke Profile Picture
    766 on at

    I just stumbled on this one, cause I made the same mistake.

    If you just want to switch the purpose / role to Delivery or anything else - just use ADDRESSLOCATIONROLES instead of ADDRESSDEFAULTROLES.

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 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans