Skip to content

Instantly share code, notes, and snippets.

@leehildebrand
Last active May 13, 2020 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leehildebrand/2249733d3317e0ee9845d2d31932e631 to your computer and use it in GitHub Desktop.
Save leehildebrand/2249733d3317e0ee9845d2d31932e631 to your computer and use it in GitHub Desktop.
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'
category='AccountCategory')
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