6

I am trying to upsert records in Account using Bulk API. After upserting records I need to update some of the custom field values to standard field values using trigger or workflow. Is it possible ???

Note: I have read in this blog that trigger wont get fired during Bulk API inserting operation. https://developer.salesforce.com/page/The_Salesforce_Bulk_API_-_Maximizing_Parallelism_and_Throughput_Performance_When_Integrating_or_Loading_Large_Data_Volumes

Experts suggestion please...

3

Did you try adding a new trigger or workflow?I have checked it by creating new work flow rule that updates Account number whenever a custom field called kunnr(SAP Customer Number) has been inserted through bulk API.It works perfectly.

Workflow rule:rule

update

And imported around 2500 records via bulk api using curl.

Result:Result

here SAP Customer Number is kunnr

It worked for all the records as such..

2

Triggers and Workflows will fire irrespective of the API you are using. Form the link that you have shared please go to the section:

Triggers
Although the flexibility of triggers is a great asset, triggers can cause many kinds of problems in your loads and integrations. Locks are one of those problems. When you’re loading records that fire one or more triggers, and any of those triggers performs either a select for update or a DML operation on records other than the record that you’re inserting, updating, or deleting, Salesforce locks those other records. These locks can in turn cause lock exceptions. Consider disabling trigger logic for your loads and integrations, or having a special, optimized code path for such activities.
Workflow Rules
When workflow rules trigger field updates, Salesforce locks the records that they update. And when multiple threads try to update the same records simultaneously, they can cause lock exceptions. Consider defining your workflow rules so that they don’t execute during loads and integrations.

Basically it implies that logic should be efficient enough to handle large data sets(Batch size).

  • But that would make the inserted data useless then, triggers and rules are there for a reason (I mean regarding the linked document suggestions) – FuuRe May 5 '16 at 12:32
  • I did not get, what are you trying to say ? – C0DEPirate May 5 '16 at 12:34
  • it's nothing about your answer, which is OK, I was referring to the "Disable triggers and workflow rules" suggestions in the link that OP shared – FuuRe May 5 '16 at 12:36
  • Yeah, that is the reason developers are forced to write code using best practices. :) – C0DEPirate May 5 '16 at 12:38
  • And by that you mean writing a class that holds the logic and operations and invoking it from the trigger, to reuse that functionality elsewhere if needed, right? – FuuRe May 5 '16 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.