You need to sign in to do that
Don't have an account?

Unexpected Token Error
I get the following Error when i try to save this
Error: Compile Error: unexpected token: 'List' at line 4 column 4
public class createoriginalfcst {
public static List<SMART_Product__c>ActiveSKUs {
List<SMART_Product__c>ActiveSKUs=[SELECT Name FROM SMART_Product__c WHERE Product_Status__c='Active']
}
}
Kindly help
The solution rather depends on what you are trying to do:
If you are attempting to define a static method called ActiveSKUs, you are missing the brackets that denote the method parameters, e.g..
public static List<SMART_Product__c>ActiveSKUs() {
If you are attempting to do something else, please give further details.
Yes, I understand that - its more about what programming construct you are writing.
Are you trying to write a method called ActiveSKUs, or are you trying to initialize a list at object creation time, or something else.
You should use parentheseis () while delcaring method name in anonymous block.
Hence your code should be
}
public class createoriginalfcst (){
public static List<SMART_Product__c>ActiveSKUs {
List<SMART_Product__c>ActiveSKUs=[SELECT Name FROM SMART_Product__c WHERE Product_Status__c='Active']
}
Try it out and this will run properly.
This line is illegal syntax:
You can't include parentheses on a class declaration - I think you are confusing the class with the constructor.
Yes, you are right bob. I got confused with method declarationa as I overlooked class keyword.
Though the following should work
public class createoriginalfcst {
public static List<SMART_Product__c>ActiveSKUs () {
List<SMART_Product__c>ActiveSKUs=[SELECT Name FROM SMART_Product__c WHERE Product_Status__c='Active']
}
}
The parenthesis should be added to ActiveSKUs static method.
I faced a similar issue and the culprit was missing parenthesis in method declaration
Just to be pedantic, you'll need to return a value from that method as per its signature (and add a semi-colon to the end of the query line).
In pedantic terms yes, but I am assuming that these details must already been taken care of by semanticAP
Yes you are right bob, but I am assuming that these details must have been taken care of by SymanticAP.
Apple_inc__c objAppleinc = new Apple_inc__c ();
objAppleinc.Name = 'Geoside consultant';
objAppleinc.Email__c = 'samuel@doodleblue.com';
objAppleinc.mobilenumber__c = '9941132612';
objAppleinc.Comments__c = 'Shipment should be done on 01/31/2016';
objAppleinc.delivery_date__c = 01/31/2016
insert objAppleinc;
System.debug('Records Has been created '+objAppleinc);