You need to sign in to do that
Don't have an account?

how to upsert performance with trigger ?
Hi Please support
how to upsert performance with trigger ?(it means old record found then update some fields else not old record found then create new Record)
how to upsert performance with trigger ?(it means old record found then update some fields else not old record found then create new Record)
In upsert operation Salesforce internally validates the data based on Object's Id or External Id.
Using the upsert operation, you can either insert or update an existing record in one call based on ID or external Id . To determine whether a record already exists, the upsert statement or Database method uses the record’s ID as the key to match records, a custom external ID field, or a standard field with the idLookup attribute set to true.
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.
So you need to write the trigger that wil invoke on both the insert and update which is equal to upsert
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_upsert.htm
Can you explane the full trigger because when i am wrting then showing error ?
Thanks
akki