Hey all -
Let's do a thread so other people can learn how to do this.
I'm working with someone who uses Salesforce in a little different way than a lot of our customers. They have a few different types of cases with mild customization but they don't use Tasks ("Activities") - so I added the Interaction ID to sync over to Task as InteractionID__c and they're adding it to the Case at Call_GUID__c.
The following code does match up the related fields well and right away. However, the tab sync (changing which case is shown based on which interaction you select) doesn't work unless we manually add a note to the activity through the embedded client.
The ask here is (and should be) simple - and ideally would be documented (or easier to find if it is because I've looked quite a bit).
What calls or other code do we need to execute beyond associating the auto-created task to the case?
It would be nice to get this answered here so other people don't waste as much time as I have digging around. From a case record standpoint in the developer debugger (in SF) I'm not seeing any difference in the tasks, cases, or even over in the call details on Genesys based on the two different methods.
Sorry if I'm missing something obvious, I'm not an expert in Salesforce. Thanks in advance!
--
trigger associateTask on Case (after insert) {
List<Task> taskUpdates = new List<Task>();
For (Case myCase : trigger.new)
if (myCase.Call_GUID__c != null) {
List<Task> matchingTasks = [SELECT Id, WhatId FROM Task WHERE InteractionID__c = :myCase.Call_GUID__c];
if(matchingTasks.size() > 0) {
Task task = matchingTasks[0];
if(task.WhatId == null) {
task.WhatId = myCase.Id;
update task;
}
}
}
}
--