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, ...
Unanswered

Create contactperson via x++

(0) ShareShare
ReportReport
Posted on by

Hello Folks,

I am trying to create contact person ID through code.

I did followed this code here from community and replaced ContactPersonEntity  of Ax2012 with ContactPersonSyncEntity  in D365 and got errors at line of code which I have shared below (please excuse for not using code snippet in the way it is intended to be used).

Please suggest a fix for errors and numseq issue described in below snippet.

ContactPersonSyncEntity contactPersonSyncEntity ;
//Get State not found error at below line of code.

  // Update the postal address information.
       contactPersonSyncEntity .createOrUpdatePostalAddress(postalAddress);

//When I comment above code to continue with execution next error I get stating contact person id should be there from below line of code.
  // Update the contact information.
        contactPersonSyncEntity .createOrUpdateContactInfo(contactInfo);


//Which is strange because before this line of code there is the code 
contactPersonSyncEntity .parmContactPersonId('CP64');
//Also will be nice f you can share how to get contatPersonId from contactperson number seqeunce sued at legal entity level

Thanks in advance

Mav

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

    Hello folks,

    Any update on this would be really helpful.

    Thanks

    Mav

  • AnithaEswaran Profile Picture
    2,032 on at

    Hi Mav,

    can you please explain your requirement ? In which F&O form are you trying to insert the data..

  • Mav Profile Picture
    on at

    Hello,

    Thanks for your note.

    Requirement is to create contact in d365 via x++, for which I had followed the steps shared in community thread, ,link of which I have shared in my initial post.

    Issue is that I get errors while using the code shared in the thread, details of which error is faced at what line of code are shared in the code snippet in my 1st post.

    Form location is Sales and marketing>Relationships>Contacts.

    Thanks

    Mav

  • Mav Profile Picture
    on at

    Hello All,

    I have resolved all the issues with contactperson ID error however unable to resolve one issue which is state not found and it comes at this line below and you will notice that we are supplying the state as WA.

           contactPersonEntity.createOrUpdatePostalAddress(postalAddress);

  • Mav Profile Picture
    on at

    Admin please delete this thread.

  • André Arnaud de Calavon Profile Picture
    300,799 Super User 2025 Season 2 on at

    Hi Mav,

    Why should this post be deleted? Do you still need help with your addresses state issue?

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

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 408 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans