Sample Apex Class:
Apex Class action setup in Einstein Bot:
Permission Set sfdc.chatbot.service.permset:
Make sure the Apex Class is added to the Permission Set sfdc.chatbot.service.permset.
- public class EinsteinChatBotController {
- public class CaseOutput {
- @InvocableVariable( required=true )
- public String sStatus;
- }
- public class CaseInput {
- @InvocableVariable( required=true )
- public String sCaseNumber;
- }
- @InvocableMethod(label='Get Case Status')
- public static List < CaseOutput > fetchCaseStatus( List < CaseInput > listCaseInputs ) {
- List < CaseOutput > objOutputs = new List < CaseOutput >();
- CaseOutput objOutput = new CaseOutput();
- Set < String > strCaseNumbers = new Set < String >();
- for ( CaseInput objCaseInput : listCaseInputs )
- strCaseNumbers.add( objCaseInput.sCaseNumber );
- objOutput.sStatus = [ SELECT Status FROM Case WHERE CaseNumber IN: strCaseNumbers LIMIT 1].Status;
- objOutputs.add( objOutput );
- return objOutputs;
- }
- }
Apex Class action setup in Einstein Bot:
Permission Set sfdc.chatbot.service.permset:
Make sure the Apex Class is added to the Permission Set sfdc.chatbot.service.permset.
Hi ! Can we show 2 results in Bot window. ??
ReplyDeleteI have scenario in which Bot should return account number of the account, which is working fine for account, issues is when 2 Account of same name exists then Bot should display 2 account number instead of only one account number.
Check this - https://www.infallibletechie.com/2020/06/einstein-bot-getting-multiple-values.html
Delete