My question is similar to this question, just that I am looking for SOAP JAVA client API based solution.
Suppose, I have a Parent object Account and it's child object Contact. I have a web application, that updates and creates the above objects using the SOAP API.
A typical use case may involve:
- Creating a new account and creating one or more contacts.
- Updating an account and adding one or more contacts.
- Updating an account and updating one or more contacts.
I would like the #2 and #3 above to happen within the same transaction. For instance, User updates and also adds a new contact in same session.
I want to use AllOrNoneHeader, so that the update to Account object and creation of new child Contact object happens within the same transaction.
The SOAP update API expects all the objects to have an ID. Therefore, I can not create a Contact within the same transaction i.e. in a single update call (that also updates account). If I split it into two steps i.e.
- In the first step update the Account object
- In the second step create the child Contact object
Then I loose the transaction support, quoting the relevant parts of documentation.
....It’s not possible to span a transaction across multiple API calls....
I can also not use upsert API, as I do not have external ID's in my object and as far I can tell it only works on objects of one type.
- What is the best way to update a parent record and create a child record within same transaction using SOAP API.