function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicholas Shepard 7Nicholas Shepard 7 

Salesforce Process Builder Apex Error: Too Many Future Calls

I've created an SalesForce Process that automates the creation of Asana projects for my org. This works well in small-scale, however when many data updates happen at once, we receive an error;

```Error Occurred: An Apex error occurred: System.LimitException: AsanaPublic: Too many future calls: 51```

I'm not sure that this can be solved using the process builder alone, so I'm thinking that I'll have to translate the process to an Apex Trigger that implements Queueable, but I'm not sure if this is the correct route. Here is what my process looks like: https://gyazo.com/a367dd0a94a8bfae2466f2dbda6fbccc

Note that "Evaluate the next criteria" is needed there to account for cases where both fields get updated in the same save operation.

Thank you in advance for the help!
SwethaSwetha (Salesforce Developers) 
HI Nicholas,
I see you also reached out on https://salesforce.stackexchange.com/questions/353138/salesforce-process-builder-apex-error-too-many-future-calls

Copying answer posted:
"The limit on future invocation is a transaction limit and when you are doing updates in bulk, the transaction could easily include more than 50 records.
You are correct that Process Builder will not solve this issue and Apex is the way to go.
  • The trigger should pass to the Queueable a list of Ids from Trigger.newMap
  • The queueable can do a callout to create the Asana project for the first Id, then enqueue again for the next Id and so on
An example of this strategy can be found in this question/answer on queueable state preservation"

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you