You are here:
Considerations for the Get Engagements Invocable Action
Review the considerations when you use the Get Engagements invocable action.
Required Editions
| Available in: Lightning Experience |
| Available in: Starter, Professional, Enterprise, and Unlimited Editions with the Industry Service Excellence add-on license |
The Engagement Interaction, Messaging Session, and Voice Call objects can relate to the Account base object through the default lookup field or a custom lookup field.
| Object | Default Lookup Field |
|---|---|
| Engagement Interaction | InitiatingAttendee |
| Messaging Session | EndUserAccount |
| Voice Call with the Match Callers to End User Records preference turned on in Amazon Setup | EndUser.Account |
| Voice Call with the Match Callers to End User Records preference turned off in Amazon Setup | ConversationParticipant.ParticipantEntity |
If the objects are related through a custom lookup field, create an invocable action that contains the details of the custom lookup field.
- Apex Invocable
Action
public class GetPreviousEngagements { @InvocableMethod(label='Get Previous Engagements' description='Get Previous Engagements related to Account') public static List<GetPreviousEngagementsOutput> getPreviousEngagements(List<GetPreviousEngagementsInput> inputs) { if (inputs == null || inputs.isEmpty()) { // Please provide valid inputs. Throw custom exceptions return null; } String accountId = inputs[0].accountId; Integer engagementsCount = inputs[0].engagementsCount; // Repeat for other engagement types as well such as 'Messaging Session' and 'Voice Call' List<EngagementInteraction> engagementInteractions = [Select Id, CreatedDate From EngagementInteraction Where CustomLookupToAccount__c = :accountId ORDER BY CreatedDate DESC LIMIT :engagementsCount]; List<DataRetrieval.Engagement> engagementList = new List<DataRetrieval.Engagement>(); for (EngagementInteraction ei: engagementInteractions) { DataRetrieval.Engagement engagement = new DataRetrieval.Engagement(); engagement.recordId = (String) ei.get('Id'); engagement.objectApiName = 'EngagementInteraction'; engagementList.add(engagement); } GetPreviousEngagementsOutput output = new GetPreviousEngagementsOutput(); output.engagements = new DataRetrieval.Engagements(engagementList); return new List<GetPreviousEngagementsOutput>{output}; } } - Invocable Action
Input
public class GetPreviousEngagementsInput { @InvocableVariable(label='Account ID' required=true) public String accountId; @InvocableVariable(label='Engagements Count') public Integer engagementsCount; } - Invocable Action
Output
public class GetPreviousEngagementsOutput { @InvocableVariable(label='Engagements') public DataRetrieval.Engagements engagements; }
After you create the invocable action:
- Replace the getEngagements invocable action with the new invocable action in the Service Innovations Einstein Copilot: Get Engagements Details flow.
- Create a fault path to the AddEmptyPromptInstructionsNoAccount element in the Service Innovations Einstein Copilot: Get Engagements Details flow.
- In the Advanced section of the invocable action properties, select the Manually assign variables checkbox and store the output values in the variable used in the getEngagements invocable action.
Did this article solve your issue?
Let us know so we can improve!

