You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@InvocableMethod(label='Einstein Chatbots - Find Cases For Contact' description='Returns a list of Cases for the specified Contact')
global static List<List<Case>> getCases(List<Contact> contacts)
{
List<Case> listCases = new List<Case>();
For (Contact currentContact : contacts)
{
if (currentContact != null && String.IsNotBlank(currentContact.id))
{
List<Case> Cases = [SELECT Id, LastModifiedDate, Status, Subject, CaseNumber, Origin, Priority FROM Case WHERE Status != 'Closed' ORDER BY LastModifiedDate DESC NULLS FIRST LIMIT 3];
if (Cases != null && Cases.size() > 0)
{
return new List<List<Case>>{Cases};
}
break;
}
}
return new List<List<Case>>{new List<Case>{new Case()}};