Apex Class:
public with sharing class ChatBotUtil {
public class ChatBotCertInput {
@InvocableVariable(required=true)
public String cert;
}
public class ChatBotCertOutput {
@InvocableVariable
public String certName;
@InvocableVariable
public String certCode;
}
@InvocableMethod(label=’Get Cert Name and code’ description=’Returns the Cert Name and Code’)
public static List < ChatBotCertOutput > getCertList(List < ChatBotCertInput > listInputs) {
List < ChatBotCertOutput > results = new List < ChatBotCertOutput >();
for ( ChatBotCertInput cert : listInputs ) {
ChatBotCertOutput item = new ChatBotCertOutput();
if ( cert.cert == ‘ADM’ ) {
item.certName = ‘Salesforce Administrator’;
item.certCode = ‘ADM 201’;
} else if ( cert.cert == ‘Platform Developer I’ ) {
item.certName = ‘Salesforce Platform Developer I’;
item.certCode = ‘PD1’;
} else if ( cert.cert == ‘Platform Developer II’ ) {
item.certName = ‘Salesforce Platform Developer II’;
item.certCode = ‘PD2’;
}
results.add(item);
}
return results;
}
}
Einstein Builder: