0

I am planning to configure ChatBot with invocable actions. I am not getting the output instead it says "Sorry, I didn't understand that". I tested in console, I am getting the output.

Am I missing anything else?

If I return some

public with sharing class ChatBotContact {
     public class ChatBotContactEmailInput {
        @InvocableVariable(required=true)
        public String EmailId;
    }

    public class ChatBotContactEmailOutput {
        @InvocableVariable(required=true)
        public String conFirstName;
        @InvocableVariable(required=true)
        public String conLastName;
        @InvocableVariable(required=true)
        public String phone;
    }

    @InvocableMethod(label='Get Contact Details' description='Returns Contact Information')
    public static List<ChatBotContactEmailOutput> getContactDetails(List<ChatBotContactEmailInput> inputs) {
        Contact c = [SELECT Id, FirstName, Email, LastName, MobilePhone FROM Contact WHERE Email =: inputs[0].EmailId];

        List<ChatBotContactEmailOutput> results = new List<ChatBotContactEmailOutput>();
        ChatBotContactEmailOutput item = new ChatBotContactEmailOutput();
        item.conFirstName = c.FirstName;
        item.conLastName = c.LastName;
        item.phone = c.MobilePhone;
        results.add(item);

        return results;
    }
}

enter image description here

enter image description here

0

I figured out the issue, the issue was in the slot Names and assigning the values in the method were wrong.

All good now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.