Dynamics 365 Web Api : Create a contact record with customer field set as contact or account

  1. Create a contact record named CustomerContact
POST <rootservice>/api/data/v8.0/contacts

{‘lastname’ : ‘CustomerContact’}

 

Note down the id1(f797401d-64c9-e711-8125-000d3a22f66f) of the record from response header

  1. Create an account record named CustomerAccount
POST <rootservice>/api/data/v8.0/accounts

{‘name : ‘CustomerContact’}

 

Note down the id2(3b0bafeb-65c9-e711-8125-000d3a22f66f) of the record from response header

  1. Create a contact named contact1 with customer set as CustomerContact
POST <rootservice>/api/data/v8.0/contacts

{

'lastname':’contact1’,

'parentcustomerid_contact@odata.bind': /contacts(f797401d-64c9-e711-8125-000d3a22f66f)'

}
  1. Create anohter contact named contact2 with customer set as CustomerAccount
POST <rootservice>/api/data/v8.0/contacts

{

'lastname':’contact2’,

'parentcustomerid_account@odata.bind': /accounts(3b0bafeb-65c9-e711-8125-000d3a22f66f)'

}

Leave a Reply

Your email address will not be published. Required fields are marked *