1

Consider this Apex method, is it correct?

@InvocableMethod(
public static void processLead(List<Lead> theLeadList) {
    System.assert(theLeadList.size() == 1);
    ...
}

Does Process builder pass in a single object in a list to the invocable method if I specify that parameter 'theLeadList' is the main object passed to the process?

Or do I have to handle an arbitrary list size in the method?

1 Answer 1

3

Because salesforce groups invocations of the process builder - say you edit 5 records in one transaction, all these records will get passed to your invocable method.

So yes, you have to handle arbitrarily large data sets.

You really need to treat it as very similar to trigger code, which also is passed lists of records that have been modified.

0

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.