You need to sign in to do that
Don't have an account?
Gaurav Jain 104
Newbie: VF Class. NEED Help!
Hello,
I am sending a survey; and to get that data stored back in org; i am trying this following clas but keep getting the error of"Compile Error: expecting right curly bracket, found 'try' at line 31 column 6:
public class Supportsurvey
{
//Part A: Vaiables Declaration
Public case caseObj{get;set;}
public string Rating{get;set;}
public string HowOften{get;set;}
public string PrefComm{get;set;}
public boolean CIJ{get;set;}
public boolean DLO{get;set;}
public boolean Deploy{get;set;}
public boolean EZC{get;set;}
public boolean TAF{get;set;}
public string Suggestions{get;set;}
// Part B: Passing variables to Case Fileds.
public string survey()
{
caseObj= new Case();
caseObj.Support_Rating__c=Rating;
caseObj.how_often__c=HowOften;
caseObj.Preferred_Communication__c=PrefComm;
caseObj.Data_Loader__c=DLO;
caseObj.Deployments__c=Deploy;
caseObj.EZ_Commits__c=EZC;
caseObj.TAF__c=TAF;
caseObj.Suggestions__c=Suggestions;
caseObj.CI_Jobs__c=CIJ;
}
try{
update caseObj;
}
//Catch the Exceptions if any
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
//Redirecting to "Thank you page" after submitting Customer Support Survey form.
public PageReference save()
{
PageReference pg = page.pro_ThankYouPage;
pg.setRedirect(true);
return pg;
}
}
I am sending a survey; and to get that data stored back in org; i am trying this following clas but keep getting the error of"Compile Error: expecting right curly bracket, found 'try' at line 31 column 6:
public class Supportsurvey
{
//Part A: Vaiables Declaration
Public case caseObj{get;set;}
public string Rating{get;set;}
public string HowOften{get;set;}
public string PrefComm{get;set;}
public boolean CIJ{get;set;}
public boolean DLO{get;set;}
public boolean Deploy{get;set;}
public boolean EZC{get;set;}
public boolean TAF{get;set;}
public string Suggestions{get;set;}
// Part B: Passing variables to Case Fileds.
public string survey()
{
caseObj= new Case();
caseObj.Support_Rating__c=Rating;
caseObj.how_often__c=HowOften;
caseObj.Preferred_Communication__c=PrefComm;
caseObj.Data_Loader__c=DLO;
caseObj.Deployments__c=Deploy;
caseObj.EZ_Commits__c=EZC;
caseObj.TAF__c=TAF;
caseObj.Suggestions__c=Suggestions;
caseObj.CI_Jobs__c=CIJ;
}
try{
update caseObj;
}
//Catch the Exceptions if any
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
//Redirecting to "Thank you page" after submitting Customer Support Survey form.
public PageReference save()
{
PageReference pg = page.pro_ThankYouPage;
pg.setRedirect(true);
return pg;
}
}
Move the closing bracket before "try" block to after "Catch" block.
Let us know if this will help you
this is the error I am getting:
Error: Compile Error: The method object <Constructor>(ApexPages.StandardController) is referenced by Visualforce Page (SupportSurvey) in salesforce.com. Remove the usage and try again. at line 4 column 12
Here's my VF page:
<apex:page standardcontroller="Case" extensions="ARSupportSurvey" sidebar="false" standardStylesheets="false" showHeader="false"
applyBodyTag="false" wizard="True" docType="HTML-5.0">
<apex:stylesheet value="{!$Resource.SupportSurveyCSS}" />
<div class="header">
<img align="left" src="{!$Resource.ARLogo}">
</img>
</div>
<img align="right" src="{!$Resource.NoDeployLogo}" width="80">
</img>
<apex:form styleClass="form-style">
<apex:pageblock >
<span style="padding-left:100px"> </span><h2>AR Customer Support Survey</h2>
</apex:pageblock>
<br>
<apex:outputLabel value="How Satisfied you are?" style="font-size:18px" for="SupportRating" ></apex:outputLabel>
<span style="padding-left:5px"></span>
<apex:inputField value="{!case.Support_Rating__c}"/>
</br>
<tr>
<td style="white-space">
<apex:outputLabel value="Frequency of the Issue?" style="font-size:18px" for="HowFrequent" > </apex:outputLabel>
<apex:outputpanel layout="block" >
<apex:inputTextarea value="{!case.how_often__c}" rows="4" cols="60" html-placeholder="Does it happen quite often? Please share.." styleClass="textarea"/>
</apex:outputpanel>
</td>
</tr>
<br>
<tr>
<td style="white-space">
<apex:outputLabel escape="false" value="How do you rate your Case Handler? </br> (How helpful the solution was?)" style="font-size:18px" for="RateUser" > </apex:outputLabel>
<span style="padding-left:5px"> </span>
<apex:inputField value="{!case.User_Rating__c}"/>
</td>
</tr>
</br>
<br>
<tr>
<td style="white-space">
<apex:outputLabel value="Preferred communication via:" style="font-size:18px" for="PrefdComm" > </apex:outputLabel>
<span style="padding-left:22px"> </span>
<apex:inputField value="{!case.Preferred_Communication__c}"/>
</td>
</tr>
</br>
<br><tr>
<td style="white-space">
<apex:outputLabel value="Other challenges you face:" style="font-size:18px" > </apex:outputLabel></td></tr></br>
<apex:outputpanel id="theOptionsPanel">
<apex:inputcheckbox value="{!case.CI_Jobs__c}" id="CIJ"/>
<apex:outputLabel value="CI Jobs" for="CIJ"></apex:outputLabel>
<br></br>
<apex:inputcheckbox value="{!case.Data_Loader__c}" id="DL"/>
<apex:outputLabel value="Data Loader" for="DL"></apex:outputLabel>
<br></br>
<apex:inputcheckbox value="{!case.Deployments__c}" id="CD"/>
<apex:outputLabel value="Deployments" for="CD"></apex:outputLabel>
<br></br>
<apex:inputcheckbox value="{!case.EZ_Commits__c}" id="EZC"/>
<apex:outputLabel value="EZ Commits" for="EZC"></apex:outputLabel>
<br></br>
<apex:inputcheckbox value="{!case.TAF__c}" id="TAF"/>
<apex:outputLabel value="TAF" for="TAF"></apex:outputLabel>
<br></br>
</apex:outputpanel>
<br>
<tr>
<td style="white-sapce">
<apex:outputLabel value="How can we Improve our product and/or service?" style="font-size:18px" for="Recommend" > </apex:outputLabel>
<apex:outputPanel layout="block">
<apex:inputtextarea value="{!case.Suggestions__c}" rows="5" cols="60" html-placeholder="We do consider your opinion.." styleClass="textarea"/>
</apex:outputPanel>
</td>
</tr>
</br>
<apex:actionRegion >
<apex:commandButton action="{!save}" value="Submit Opinion!" id="csbutton" styleClass="ARbutton"/>
</apex:actionRegion>
</apex:form>
</apex:page>
Here's my Apex Code:
public class ARSupportSurvey
{
//Part A: Vaiables Declaration
Public case caseObj{get;set;}
public string Rating{get;set;}
public string HowOften{get;set;}
public string PrefComm{get;set;}
public boolean CIJ{get;set;}
public boolean DLO{get;set;}
public boolean Deploy{get;set;}
public boolean EZC{get;set;}
public boolean TAF{get;set;}
public string Suggestions{get;set;}
// Part B: Passing variables to Case Fileds.
public string survey()
{
caseObj= new Case();
caseObj.Support_Rating__c=Rating;
caseObj.how_often__c=HowOften;
caseObj.Preferred_Communication__c=PrefComm;
caseObj.Data_Loader__c=DLO;
caseObj.Deployments__c=Deploy;
caseObj.EZ_Commits__c=EZC;
caseObj.TAF__c=TAF;
caseObj.Suggestions__c=Suggestions;
caseObj.CI_Jobs__c=CIJ;
try{
insert caseObj;
}
//Catch the Exceptions if any
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
return '';
}
//Redirecting to "Thank you page" after submitting Customer Support Survey form.
public PageReference save()
{
PageReference pg = page.ar_ThankYouPage;
pg.setRedirect(true);
return pg;
}
}
you will have to comment the complete code in VF page and than change the code in controller
or just write new controller and change the name of comtroller in your VF page.
can you elaborate this -
(Also, I am trying to dynamically pass the Case Id to the Vf page(how? as its not taking id in case template!) that is triggered to be sent via email. Page is connected to site. Plz help.
"
Let me explain:
I have a template referring to Vf page. Case Id being passed there. goes to respective customer. S/he fills out. Thankyou page displays.
NOw I have to get that data back into my SF org. DML statement of New or Update not making it happen. What i am missing??? and how to fix it? Plz help.
modify your apex class as follows, it should work. The reason save was not working was you have overrden the save method in controller but the actual SAVE method was not called inside it.
<pre>
public class ARSupportSurvey {
private ApexPages.StandardController sc;
//constructor for extension
public ARSupportSurvey(ApexPages.StandardController sc) {
this.sc = sc;
}
//Part A: Vaiables Declaration
Public case caseObj {get; set;}
public string Rating {get; set;}
public string HowOften {get; set;}
public string PrefComm {get; set;}
public boolean CIJ {get; set;}
public boolean DLO {get; set;}
public boolean Deploy {get; set;}
public boolean EZC {get; set;}
public boolean TAF {get; set;}
public string Suggestions {get; set;}
// Part B: Passing variables to Case Fileds.
//Not sure why you have done this???how are these varbles getting values?
public string survey() {
caseObj = new Case();
caseObj.Support_Rating__c = Rating;
caseObj.how_often__c = HowOften;
caseObj.Preferred_Communication__c = PrefComm;
caseObj.Data_Loader__c = DLO;
caseObj.Deployments__c = Deploy;
caseObj.EZ_Commits__c = EZC;
caseObj.TAF__c = TAF;
caseObj.Suggestions__c = Suggestions;
caseObj.CI_Jobs__c = CIJ;
try {
insert caseObj;
}
//Catch the Exceptions if any
catch (System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
return '';
}
//Redirecting to "Thank you page" after submitting Customer Support Survey form.
public PageReference save() {
//execute standard save method
sc.save();
PageReference pg = page.ar_ThankYouPage;
pg.setRedirect(true);
return pg;
}
}
</pre>
And, I am passing the Case id on email template..that is Id is not visible in URL.
what i am missing?
public class TestSupportSurvey
{
Private ApexPages.StandardController sc;
public TestSupportSurvey(ApexPages.StandardController sc) {
this.sc=sc;
}
Public case caseObj{get;set;}
public string Rating{get;set;}
public string HowOften{get;set;}
public string PrefComm{get;set;}
public boolean CIJ{get;set;}
public boolean DLO{get;set;}
public boolean Deploy{get;set;}
public boolean EZC{get;set;}
public boolean TAF{get;set;}
public string Suggestions{get;set;}
public string casenum {get;set;}
public string survey()
{
//first line i just added..
Case caseObj = [select id,casenumber from Case where casenumber =: casenum];
caseObj.Support_Rating__c=Rating;
caseObj.how_often__c=HowOften;
caseObj.Preferred_Communication__c=PrefComm;
caseObj.Data_Loader__c=DLO;
caseObj.Deployments__c=Deploy;
caseObj.EZ_Commits__c=EZC;
caseObj.TAF__c=TAF;
caseObj.Suggestions__c=Suggestions;
caseObj.CI_Jobs__c=CIJ;
try{
insert caseObj;
}
//Catch the Exceptions if any
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
return '';
}
//Redirecting to "Thank you page" after submitting Customer Support Survey form.
public PageReference save()
{
sc.save();
PageReference pg = page.ar_ThankYouPage;
pg.setRedirect(true);
return pg;
}
}
Scenario: Case Closes>Email goes with a Site Link that nvoking VF to end client>client fills it>submit it>and data gets stored in Case(Standard) object in the SAME record( of closed case). NOT looking to create a NEW record! Hope I am clear.