Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pass multiple, strongly typed parameters from Process Builder to Apex #1
public class ProcessHandlerShowAccounts {
public class AccountParameter{
@InvocableVariable(required=true)
public Id accountId;
@InvocableVariable(required=true)
public String name;
}
@InvocableMethod(label='handleNewAccounts' description='Reconstitue the Accounts being inserted based on the variables passed from Process Builder')
public static void handleNewAccounts(AccountParameter[] accountParameters) {
Account[] accounts = new Account[]{};
for(AccountParameter a : accountParameters) accounts.add(new Account(Id=a.accountId,Name=a.name));
system.debug('****** accounts: '+accounts);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment