0

1)If we can call a batch from Process Builder, then is there any need to write an Apex Trigger?

2) If I want to update more than 50,000 records on another object, then we can not query that much in a trigger, so how to accomplish this?

1
  • depends how and from where you plan on updating the 50k+ records, you should look for batch apex and for the bulk api's documentation
    – glls
    Apr 20, 2017 at 3:40

1 Answer 1

2

You can call a batch class from a trigger or the Process Builder, but the trigger will do so more efficiently. Either way, the point of calling the batch class is to query more than 50,000 records and updating them asynchronously. The batch's query will not count towards the trigger's query limits.

2
  • What about running into Lmits? We can not have 5 Jobs running at the same time right? Is Queable Class a better Idea?
    – mvk1991
    Apr 20, 2017 at 6:02
  • @user1690928 You can have up to 105 batches (5 running + 100 on hold). I suspect that Process Builder is likely to run into limits. Queueable would probably be better, but you might still be limited to 50 records per batch unless you can get Process Builder to somehow pass in a list of affected records. Honestly, this is one of the use cases where you'd prefer to use Apex Code instead of monkeying around with Process Builder. It's simply not as efficient as Apex Code in some cases.
    – sfdcfox
    Apr 20, 2017 at 6:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .