You need to sign in to do that
Don't have an account?
Natasha Ali
No Syntax error in Apex class but dev console is showing Unexpected token '{'. error??
Hi,
I have the following controller which seems fine in terms of syntax but I'm still getting an error? I only added a StageName to the SOQL (the original controller deployed fine without it):
The original deployed one:
Many Thanks,
Natasha :)
I have the following controller which seems fine in terms of syntax but I'm still getting an error? I only added a StageName to the SOQL (the original controller deployed fine without it):
public class OpportunityVFController { public List<Opportunity> opp {get;set;} public OpportunityVFController { opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity WHERE (StageName = '1 - Qualifying'or StageName = '2 - Booked for CK' or StageName = '3 - Live' or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)]; } }
The original deployed one:
public class OpportunityVFController { public List<Opportunity> opp {get;set;} public OpportunityVFController { opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity WHERE (StageName = '2 - Booked for CK' or StageName = '3 - Live' or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)]; } }Any help is much appreciated!
Many Thanks,
Natasha :)
The issue is that your object creation syntax is wrong.constructors are method calls and also require parentheses.
Try the following code it may be helpful for you: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
All Answers
The issue is that your object creation syntax is wrong.constructors are method calls and also require parentheses.
Try the following code it may be helpful for you: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
You have to add () in a constructor.Try the below code:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi