I'm trying to set a trigger to link the results of a survey to the relevant case or chat transcript. It seems SurveyForce was not meant to do that but I tried adding a question on the survey that stores the Chatkey. And here is the code of the trigger :
trigger Test on LiveChatTranscript (before insert)
{
set<string> allSurveyStrings = new set<string>();
for (SurveyTaker__c b : trigger.new)
{
allSurveyStrings.add(b.Response);
}
for (LiveChatTranscript a: Trigger.new)
{
Id SurveyTaker__c= [SELECT id FROM SurveyTaker__c WHERE Response.contains(a.chatKey) IN : allSurveyStrings]
a.SurveyTaker__c = Id SurveyTaker__c;
}
}
However the building fails everytime saying "Didn't understand relationship 'a' in field path"
Any help please ?
Response.contains(a.chatKey)
part ? That doesn't look like valid SOQL.