5

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 processes 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:

enter image description here

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.

  • Picklist values are not evaluated correctly in formulas when sObjects are passed in through flow triggers .Are you evalulating picklist in formula ? – sfdc Apr 29 '15 at 17:34
  • No, there a no picklists on the object... – Phil Hawthorn Apr 29 '15 at 18:27
  • There are a few bulkificaiton gothca's around with Process Builder, sadly more than i feel there should have been for v1 GA release. Can you share a screenshot of your setup and some sample code? – Andrew Fawcett May 3 '15 at 13:06
-1

I came across same error. But I set the return type to the same type of input parameter, it worked. I thought the return type of the InvocableMethod must not be "void" when it processes some records. Please try it!

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.