You need to sign in to do that
Don't have an account?
Justin Bernard Rafael Cosio
I need to add an APEX class but the "Apex Classes" option is disabled.
So, I already have a VisualForce page up, now, the thing is, i need to add an APEX class extension but unfortunately, for my account, the "Apex Classes" option under the develop menu is disabled. So how do i get this class to be attached to my webpage.
public class CoreValuesEXt
{
ApexPages.StandardController sc;
public boolean readonly {get; set;}
public Core_Values__c cv {get; set;}
public integer countEdit = 1;
public string buttonValue {get; set;}
public integer recordScan;
public CoreValuesExt(ApexPages.StandardController sc)
{
this.sc = sc;
cv = new Core_Values__c();
cv.Account__c = sc.getid();
readonly = true;
buttonValue = 'Edit';
recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];
if (recordScan != 0){
cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];
}
}
public ApexPages.PageReference Save()
{
return sc.Save();
}
public void ApplyAction()
{
countEdit++;
Integer modolus = Math.mod(countEdit, 2);
String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;
if(modolus == 0)
{
readonly = false;
buttonValue = 'Save';
}
else
{
if(total != 'nullnullnullnullnullnull')
{
if (recordScan == 0){
insert cv;
readonly = true;
buttonValue = 'Edit';
}
else
{
update cv;
readonly = true;
buttonValue = 'Edit';
}
}
}
}
}
public class CoreValuesEXt
{
ApexPages.StandardController sc;
public boolean readonly {get; set;}
public Core_Values__c cv {get; set;}
public integer countEdit = 1;
public string buttonValue {get; set;}
public integer recordScan;
public CoreValuesExt(ApexPages.StandardController sc)
{
this.sc = sc;
cv = new Core_Values__c();
cv.Account__c = sc.getid();
readonly = true;
buttonValue = 'Edit';
recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];
if (recordScan != 0){
cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];
}
}
public ApexPages.PageReference Save()
{
return sc.Save();
}
public void ApplyAction()
{
countEdit++;
Integer modolus = Math.mod(countEdit, 2);
String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;
if(modolus == 0)
{
readonly = false;
buttonValue = 'Save';
}
else
{
if(total != 'nullnullnullnullnullnull')
{
if (recordScan == 0){
insert cv;
readonly = true;
buttonValue = 'Edit';
}
else
{
update cv;
readonly = true;
buttonValue = 'Edit';
}
}
}
}
}
Develop
API
Components
Custom Settings
Email Services
Lightning ComponentsBETA
Pages
Static Resources
Remote Access
Also check following:
You mean that "new" button in "Setup-> App Setup -> Develop -> Apex classes" menu is disabled for you?
Please go to your Profile page (can be accessed for example by clicking the profile name in "My Personal information") and search on the page for "Author Apex" permission. This checkbox must be ticked if you want to be a developer.
Thanks