Tuesday, 11 September 2012

Upsert

* upsert sObject​​ opt_external_id
* opt_external_id​​ is an optional variable that specifies the custom field that should be used to match records that already exist in your organization's data
How Upsert Chooses to Insert or Update
Upsert uses the sObject record's primary key (or the external ID, if specified) to determine whether it should create a new object record or update an existing one:
  • If the key is not matched, then a new object record is created.
  • If the key is matched once, then the existing object record is updated.
  • If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.


Refer:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_upsert.htm

No comments:

Post a Comment

Labels