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 :
Customer experience | Sales, Customer Insights,...
Answered

Create a Contact associated with a given Account through web api

(0) ShareShare
ReportReport
Posted on by 25

Hello,

I'm having troubles trying to create a new contact with a given account. I'm using the web api. I'm sending a HTTP Post request to the web api endpoint with this application/json data in the body : 

{"new_originspot":"true","fullname":"New Contact","emailaddress1":"newcontact@skynet.be","new_language":5,"parentcustomerid_account@odata.bind":"6bb07b9b-5f29-e911-a966-000d3ab799ec"}

This request throws me this exception : "Resource not found for the segment '6bb07b9b-5f29-e911-a966-000d3ab799ec'."

It seems like the Account guid isn't existing but it actually does, because when i lookup after it in the CRM i found it by its guid and it's the same one, plus : the guid was retrieved from the crm web api, So i don't really understand this error...

The thing is when i remove the "parentcustomerid_account@odata.bind":"6bb07b9b-5f29-e911-a966-000d3ab799ec" part from the json, the contact is successfully created but he belongs to no Account... How can i create a contact that belongs to a given account ?

Does anyone have any idea how can solve that ?

Thank you ! 

I have the same question (0)
  • Verified answer
    Miguel Lourenco Profile Picture
    on at

    Hi Shirro,

    Can you try:

    {"new_originspot":"true","fullname":"New Contact","emailaddress1":"newcontact@skynet.be","new_language":5,"parentcustomerid_account@odata.bind":"/accounts(6bb07b9b-5f29-e911-a966-000d3ab799ec)"}

    Also test this from inside the Dynamics:

    var entity = {};

    entity["parentcustomerid_account@odata.bind"] = "/accounts(feccafc9-8ad5-e911-a812-000d3ab8c2e6)";

    entity.firstname = "hi";

    entity.lastname = "hihi";

    Xrm.WebApi.online.createRecord("contact", entity).then(

       function success(result) {

           var newEntityId = result.id;

       },

       function(error) {

           Xrm.Utility.alertDialog(error.message);

       }

    );

    Hope it helps.

  • Shirro Profile Picture
    25 on at

    Hello Miguel,

    Thank you for your answer  ! That was was i needed ! It works now !

    Thanks a lot !

    Shirro.

  • Sumir Profile Picture
    10 on at

    Hi Need to know where i can find sample request and response for this service

    [Organization URI]/api/data/v9.2/contacts

    Thanks

    Sumir

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi Sumir,

    As the thread is already closed. Please create a new thread.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

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 > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 96

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 69 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans