function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michele McGeoyMichele McGeoy 

Error in SOQL statement: First SObject of the FROM statement must be a valid SObject type

I'm new to Apex coding and am making some modifications to a colleagues code. 
I've added this line and am getting the error:  First SObject of the FROM statement must be a valid SObject type. at line 106 column 36  
Here is the statement:
for(NWSHOP__Bookings__c bk: [Select id,ownerId  from NWSHOP.Bookings__c where NWSHOP__Customer_Name__r.CMAX_upload__c = true and LastModifieddate >: exportSettingsObj.NWSHOP__LastExportDate__c])

NWSHOP__Bookings__c is a custom object. 
any hints on what a "valid SObject type" is?
Best Answer chosen by Michele McGeoy
Amit Chaudhary 8Amit Chaudhary 8
Hi Michele,

You code should be :-

for(NWSHOP__Bookings__c bk: [Select id,ownerId  from NWSHOP__Bookings__c  where NWSHOP__Customer_Name__r.CMAX_upload__c = true and LastModifieddate >: exportSettingsObj.NWSHOP__LastExportDate__c])

Please let us know if that will help you.
Thanks,
Amit Chaudhary

All Answers

Robert ZentgrafRobert Zentgraf
Hi Michele,

please try NWSHOP__Bookings__c instead of NWSHOP.Bookings__c. NWSHOP.Bookings__c is not a SObject.

Regards
Robert
(mindforce: http://www.mind-force.de) (http://www.mind-force.de)
Amit Chaudhary 8Amit Chaudhary 8
Hi Michele,

You code should be :-

for(NWSHOP__Bookings__c bk: [Select id,ownerId  from NWSHOP__Bookings__c  where NWSHOP__Customer_Name__r.CMAX_upload__c = true and LastModifieddate >: exportSettingsObj.NWSHOP__LastExportDate__c])

Please let us know if that will help you.
Thanks,
Amit Chaudhary
This was selected as the best answer
Michele McGeoyMichele McGeoy
Thanks guys. That did the trick!