You need to sign in to do that
Don't have an account?
Maria Alexander 9
Custom object invalid inside my apex controller?
I'm working on this Trailhead challenge : Save and Load Records with a Server-Side Controller
As required, I've created an Apex class to write my server-side controller - CampingItemController.
My code seems perfectly alright. I've tried with other code too that seems to work for others too.
The problem is that my console tells me that Camping_Item__c is an invalid type. I don't seem to understand where I went wrong. Would appreciate if someone couldhelp me with this. Have been stuck with this for a really long time.
As required, I've created an Apex class to write my server-side controller - CampingItemController.
My code seems perfectly alright. I've tried with other code too that seems to work for others too.
The problem is that my console tells me that Camping_Item__c is an invalid type. I don't seem to understand where I went wrong. Would appreciate if someone couldhelp me with this. Have been stuck with this for a really long time.
public with sharing class CampingListController{
@AuraEnabled
public static List<Camping_Item__c> getItems() {
return [SELECT Id, Name, Price__c, Quantity__c, Packed__c
FROM Camping_Item__c];
}
@auraenabled
public static Camping_Item__c saveItem (Camping_Item__c item){
insert item;
return item;
}
}