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
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 !
AnupamAnupam
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
Hello,

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.
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003I2gDEAS

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?

Regards
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: 

www.domainname.com/apex/takesurvey(vf-page)?id=a050Y00000GdK45QAF&cId={!Contact.Id}&caId=none

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.

www.domainname.com/apex/takesurvey(vf-page)?id=a050Y00000GdK45QAF&cId={!Contact.Id}&caId=none

id=a050Y00000GdK45QAF
cId={!Contact.Id}
caId=none

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';

        init();
    } 
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.  

Greetings 
Sandra