function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bermager@gmail.combermager@gmail.com 

How to link Contact with Account

Hi, guys!

Is it possible to create an account record and a related contact using single request?

 

I have something like this for adding an account, but I can't figure out how to add a contact under it....

Here is the request:

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>00Db0000000JZ76!ARQAQNTjur2522OhStGS0BXeikNeoyFg0ddL4uSue7nNuiY27f39u_IkOZruHEsS5rCwu3rtSfjZgqfaLRsg3dqeb8uHUX8B</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:create>
<urn:sObjects xsi:type="Account">
<urn1:Name>SOAPUI_test1</urn1:Name>
<urn1:Contacts>
</urn1:Contacts>
</urn:sObjects>
</urn:create>
</soapenv:Body>
</soapenv:Envelope>

 

Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

The out of the box Web Services (SOAP API / REST API) give you CRUD and Query API's. These API's will not let you create two records in one request that are of different types (I.E. Account and Contact in one request).

 

However you can achieve this using custom Apex Web Services.

 

Using Apex Web Services you could create a service which takes an Account and Contact record in one request and creates both records in SFDC.

 

http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts

All Answers

Cory CowgillCory Cowgill

The out of the box Web Services (SOAP API / REST API) give you CRUD and Query API's. These API's will not let you create two records in one request that are of different types (I.E. Account and Contact in one request).

 

However you can achieve this using custom Apex Web Services.

 

Using Apex Web Services you could create a service which takes an Account and Contact record in one request and creates both records in SFDC.

 

http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts

This was selected as the best answer
bermager@gmail.combermager@gmail.com
Thanks a lot, Cory!