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
Tim__mTim__m 

sObject type 'Site' is not supported

This is fun. If you run this block of APEX in the system log everything works without issue...

 

Site mySite = [Select AnalyticsTrackingCode From Site where Name = 'My_Portal' limit 1];
System.debug(mySite.analyticsTrackingCode);

BUT, if you put the same block of APEX in a class and try to save the class you get: Save error: sObject type 'Site' is not supported.

 

What is up with that?

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

Is your class set to the latest api version ?

All Answers

rungerrunger

That's odd, it worked for me.

Tim__mTim__m
Are you on a dev org or sandbox? I'm seeing the issue in a sandbox but I have not tested on a dev org or any where else.
SuperfellSuperfell

Is your class set to the latest api version ?

This was selected as the best answer
Tim__mTim__m

Simon, what would we do without you?

 

It is an older class so no, not using the latest api, but tomorrow it will be.

 

I think this is the 3rd time I have forgotten to check the api version for issues like this. You would think I would have learned by now!

 

Thanks a bunch Simon!

 

Tim -