+ Start a Discussion
Sandra WicketSandra Wicket 

survey force: Survey__c Controller

Hi there, 
i installed the Survey Force App from the appexchange market. Because the app is not supported i want to unterstand  the "main Code" and the basics. I cant find the standard controller "survey__c". I didnt know that for each custom object is automatically created a standard controller.  Is there a way to view the standardcontroller ?  

Thanks for your help !
Hi Sandra

No you cannot see the code as any App downloaded from AppExchange is managed package. 
Sandra WicketSandra Wicket
Hi Anupam, 
i have acess to the apex classes and visualforce pages . 
Alain CabonAlain Cabon

Anyone can get the source code (unmanaged package):

Survey Force (Lightning Ready) allows you to create, send, and capture customer feedback natively in salesforce.com.

The standard controller "survey__c" is an internal code for default standard functionalities, the most important is the extension ;

<apex:page standardcontroller="Survey__c" title="Survey" extensions="SurveyAndQuestionController" cache="false" sidebar="false" showheader="false">

This is an Apex class ( SurveyAndQuestionController )

What is your problem?

Sandra WicketSandra Wicket
Hello Alain, 
i want to unterstand the app step by step. I started with the visualforce Page "TakeSurvey". 

The background story is that i created a survey without coding (Visual Editor + Force.com Site) a few days ago. The Flow works fine to create records for a custom object but i am not able to connect the record to an account or a contact.  The app is able to do that. The app creates a url for each survey. The Url looks like this: 


I want to unterstand how it works.  Any advice ? 

Thanks for your help guys ! 

Alain CabonAlain Cabon
Don't search for the standard controller source (it doesn't exist), just look at the extension classes.



Visualforce page:
<apex:page standardcontroller="Survey__c" extensions="ViewSurveyController" cache="false" sidebar="false" showheader="false">

/* Controller associated with pages rendering the survey.
 * Used by SurveyPage, ResultsPage, TakeSurvey
global virtual with sharing class ViewSurveyController {

// CONSTRUCTOR (same name without return value) CALLED FIRST (entry point)
public ViewSurveyController(ApexPages.StandardController stdController) {
        // Get url parameters
        surveyId = Apexpages.currentPage().getParameters().get('id');   // surveyId = 'a050Y00000GdK45QAF'
        caseId   = Apexpages.currentPage().getParameters().get('caId');  //  caseId = 'none'
        contactId = Apexpages.currentPage().getParameters().get('cId');   //  contactId = {!Contact.Id}
        if(caseId ==null || caseId.length()<15){
            caseId = 'none';
        if(contactId ==null || contactId.length()<15){
            contactId = 'none';
        // By default the preview is not showing up
        renderSurveyPreview = 'false';

Sandra WicketSandra Wicket
Hi Alain, 
thanks for your time Alain. I unterstand how the url is generated, but i dont unterstand how the record is generated for each url. I am looking forward to learn apex in the future.