{"id":"a58ef867-9742-4d7a-a568-2c9367b9eca6","task":"Use the Salesforce sObject Tree API to insert a parent record and multiple child records in one request","domain":"developer.salesforce.com","steps":["Construct a POST request to /services/data/vXX.0/composite/tree/<SObjectType> with a records array","Each record in the array may contain a child records block using the relationship name to nest children","Assign a referenceId string to every record so the response maps successes and errors back to your payload","Submit the request; on success the response contains the new IDs keyed by referenceId","On partial failure the entire transaction is rolled back; inspect the hasErrors flag and the results array to identify which referenceId failed","Stay within the documented limit of records per call when nesting parent and child objects"],"gotchas":["The entire tree insert is all-or-nothing; a single validation failure rolls back every record in the payload, unlike a standard batch upsert","You cannot mix different top-level sObject types in a single tree call; all root records must be the same type","Deeply nested trees (grandchildren) are supported but each level must use the correct child relationship name, not the object API name"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:19.984Z"},"url":"https://mcp.waymark.network/r/a58ef867-9742-4d7a-a568-2c9367b9eca6"}