Has anyone come across this error when trying to use Process Builder/@InvocableMethod to call an Apex class?
This is the error I see in the Debug log:
Could not evaluate formula for value passed to Flow Generate_Royalty_Invoice. FlowDefId: 300w0000000CnEL FlowVersionId: 301w00000000IGr: Index: 1, Size: 1
This is the error I receive in data loader:
Error message:The record couldn't be saved because it failed to trigger a flow.
This only occurs when:
- Data is loaded via data loader
- There is more than one record loaded
i.e., it does not happen for records inserted manually or via Apex.
There are no errors in the @InvocableMethod
Thanks!
EDIT
Here's as much of the InvocableMethod that you need to see, it successfully process
es one ItemToProcess
and then fails seemingly after that - it would eventually go on to pass the id's gathered to a batch job, but it never gets that far (unless you're only processing one record). If I run each record separately, it works every time:
global class RoyaltyProcessingService
{
@InvocableMethod(label='Process Royalty' description='Processes Royalty Invoice')
global static void process(List<RoyaltyProcessingService.ItemToProcess> itemsToProcess)
{
Set<Id> invoiceTypeIdsToProcess = new Set<Id>();
Map<Id,Set<Id>> accountIdsToProcess = new Map<Id,Set<Id>>();
for(RoyaltyProcessingService.ItemToProcess itemToProcess : itemsToProcess)
{
process(itemToProcess.Input, invoiceTypeIdsToProcess, accountIdsToProcess, itemToProcess.InvoicesArePosted);
}
}
}
The Process itself is really simple, showing the action for convenience:
In essence, I am only using the Process as a form of Trigger, so I can switch on/off easily and also pass in a config Boolean - its so much more convenient than a Trigger, so it would be great to get it working.