Closed bburhans closed 5 years ago
@bburhans Sorry it's taken this long but I looked into this today. The reason why the ID isn't returned is because it's not returned by Salesforce in the REST call. This would require another call to the API as you've described. I don't see this as something that would be added to the upsert call because (1) you already know the external id for the record and (2) adding a subsequent call to retrieve the record Id diverges from the one-request-per-method pattern that exists in nforce.
I'm going to close this but I'm happy to discuss further if you feel there is still a valid use case.
The insert method returns an object that includes
id
, the ID for the newly created record. Upsert only returns an empty string when it succeeds at updating an existing record; a separate SOQL query or similar is needed to determine the ID of the record you just updated, which isn't atomic with the upsert transaction.