function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandy Cook 1Sandy Cook 1 

Live agent > Surveyforce > pass through agentID and caseID to SurveyTaken Object

Hi, First question so go easy on me.

We are using live agent.
After a Live agent interaction we want to ask a few survey questions.
I set up Surveyforce and have the survey being viewed and answers being save.
However would like to also save the caseID and agentID to the results.

The object <SurveyTaker> has the attributes <User_c> and <Case__c>.
I've added a div tag to the TakeSurvey visualforce page and can output the JSON with these elements (in order to convince myself they were there!) This works.
 
<div id="passInDataToSurvey"> 
Chat Details: <apex:outputText value="{!$CurrentPage.parameters.chatDetails}" />
Attached Records : <apex:outputText value="{!$CurrentPage.parameters.attachedRecords}" />
</div>
So I have my JSON. I want to parse that and pass through the attributes. Something like... (probably not the way to do it...)
<script> 
var getUser = JSON.parse({!$CurrentPage.parameters.chatDetails}); 
document.getElementById("User__c").innerHTML = getUser.agent.userId; 
</script> 

<apex:inputHidden value="{!User__c}" id="User__c"/>

But when I save the visualforce page I get the error Unknown property 'Survey__cStandardController.User__c' as the User__c attribute is on <SurveyTaker> not <Survey__c>

Would be awesome if anyone could help,

Cheers
Ruwantha  LankathilakaRuwantha Lankathilaka
Can you share the survey,takesurvay and user relationship screenshot from schema builder? and the visualforce page and the controller