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 #2
public class ProcessHandlerShowOpps {
public class OpportunityParameter{
@InvocableVariable(required=true)
public Id oppId;
@InvocableVariable(required=true)
public String name;
@InvocableVariable(required=true)
public Decimal amount;
@InvocableVariable(required=true)
public Date closeDate;
}
@InvocableMethod(label='showOpps' description='Reconstitue the Opportunities being passed from Flow')
public static void showOpps(OpportunityParameter[] opportunityParameters) {
Opportunity[] opps = new Opportunity[]{};
for(OpportunityParameter opp : opportunityParameters) opps.add(new Opportunity(Id=opp.oppId,Name=opp.name,Amount=opp.amount,CloseDate=opp.closeDate));
system.debug('****** opps: '+opps);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment