Attached patch replaces the if/else create/update workaround with Salesforce's idempotent upsert method.

From the documentation:

/**
* Creates new objects and updates existing objects; uses a custom field to
* determine the presence of existing objects. In most cases, we recommend
* that you use upsert instead of create because upsert is idempotent.

* Available in the API version 7.0 and later.
*
* @param string $ext_Id External Id
* @param array $sObjects Array of sObjects
* @return UpsertResult
*/
public function upsert($ext_Id, $sObjects)

CommentFileSizeAuthor
salesforce-upsert.patch1.98 KBaaronbauman

Comments

Anonymous’s picture

Patch applied fine on latest development version. Upsert worked as expected.

aaronbauman’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.