Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
sObject Tree Request Body
Describes a collection of sObject trees to create with the sObject Tree resource.
sObject Tree Collection Input
The request body contains a records collection that includes sObject trees.
Properties
| Name | Type | Description | Required or Optional |
|---|---|---|---|
| records | sObject Tree Input[] | Collection of record trees to create. Each tree’s root record type must correspond to the sObject specified in the sObject Tree URI. | Required |
Root XML Tag: <SObjectTreeRequest>
JSON example
1{
2"records" :[{
3 "attributes" : {"type" : "Account", "referenceId" : "ref1"},
4 "name" : "SampleAccount",
5 "phone" : "1234567890",
6 "website" : "www.salesforce.com",
7 "numberOfEmployees" : "100",
8 "industry" : "Banking",
9 "Contacts" : {
10 "records" : [{
11 "attributes" : {"type" : "Contact", "referenceId" : "ref2"},
12 "lastname" : "Smith",
13 "title" : "President",
14 "email" : "sample@salesforce.com"
15 },{
16 "attributes" : {"type" : "Contact", "referenceId" : "ref3"},
17 "lastname" : "Evans",
18 "title" : "Vice President",
19 "email" : "sample@salesforce.com"
20 }]
21 }
22 },{
23 "attributes" : {"type" : "Account", "referenceId" : "ref4"},
24 "name" : "SampleAccount2",
25 "phone" : "1234567890",
26 "website" : "www.salesforce2.com",
27 "numberOfEmployees" : "100",
28 "industry" : "Banking"
29 }]
30}XML example
1<SObjectTreeRequest>
2 <records type="Account" referenceId="ref1">
3 <name>SampleAccount</name>
4 <phone>1234567890</phone>
5 <website>www.salesforce.com</website>
6 <numberOfEmployees>100</numberOfEmployees>
7 <industry>Banking</industry>
8 <Contacts>
9 <records type="Contact" referenceId="ref2">
10 <lastname>Smith</lastname>
11 <title>President</title>
12 <email>sample@salesforce.com</email>
13 </records>
14 <records type="Contact" referenceId="ref3">
15 <lastname>Evans</lastname>
16 <title>Vice President</title>
17 <email>sample@salesforce.com</email>
18 </records>
19 </Contacts>
20 </records>
21 <records type="Account" referenceId="ref4">
22 <name>SampleAccount2</name>
23 <phone>1234567890</phone>
24 <website>www.salesforce2.com</website>
25 <numberOfEmployees>100</numberOfEmployees>
26 <industry>Banking</industry>
27 </records>
28</SObjectTreeRequest>sObject Tree Input
An sObject tree is a recursive data structure that
contains a root record, its data, and its child records represented as other sObject trees.
Properties
| Name | Type | Description | Required or Optional |
|---|---|---|---|
| attributes | Collection | Attributes for this record. The attributes property contains two required subproperties: type (this record’s type) and referenceId (reference ID for this record). The ID is case-sensitive and must be unique in the context of the request. Values must start with an alphanumeric character and contain only letters, numbers, or underscores (’_’). In XML, include attributes inside the records element. | Required |
| Required object fields | Depends on field | Required fields and field values for this record. | Required |
| Optional object fields | Depends on field | Optional fields and field values for this record. | Optional |
| Child relationships | sObject Tree Collection Input | This record’s child relationships, such as an account’s child contacts. Child relationships are either master-detail or lookup relationships. To view an object’s valid child relationships, use the sObject Describe resource or Schema Builder. The value of this property is an sObject Tree Collection Input that contains child sObject trees. | Optional |
Root XML Tag: <records>
JSON example
1{
2"attributes" : {"type" : "Account", "referenceId" : "ref1"},
3"name" : "SampleAccount",
4"phone" : "1234567890",
5"website" : "www.salesforce.com",
6"NumberOfEmployees" : "100",
7"industry" : "Banking",
8"Contacts" : {
9 "records" : [{
10 "attributes" : {"type" : "Contact", "referenceId" : "ref2"},
11 "lastname" : "Smith",
12 "title" : "President",
13 "email" : "sample@salesforce.com"
14 },{
15 "attributes" : {"type" : "Contact", "referenceId" : "ref3"},
16 "lastname" : "Evans",
17 "title" : "Vice President",
18 "email" : "sample@salesforce.com"
19 }]
20 }
21}XML example
1<records type="Account" referenceId="ref1">
2 <name>SampleAccount</name>
3 <phone>1234567890</phone>
4 <website>www.salesforce.com</website>
5 <numberOfEmployees>100</numberOfEmployees>
6 <industry>Banking</industry>
7 <Contacts>
8 <records type="Contact" referenceId="ref2">
9 <lastname>Smith</lastname>
10 <title>President</title>
11 <email>sample@salesforce.com</email>
12 </records>
13 <records type="Contact" referenceId="ref3">
14 <lastname>Evans</lastname>
15 <title>Vice President</title>
16 <email>sample@salesforce.com</email>
17 </records>
18 </Contacts>
19</records>