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
admintrmpadmintrmp 

Using getContent() in Force.com Sites

I'm trying to use getContent() on the Force.com sites to pull some files with data in from a static resource.

 

I've been able to do it successfully with a normal Salesforce app, but in Sites I can't seem to get any data. It puts me straight onto a maintenance page with no error messages or debug logs (as I'm only a guest).

 

Does anyone have any ideas?

kandasmukandasmu

Probably, you get the error message when you use preview as admin option in Sites. 

admintrmpadmintrmp

I don't even know how to preview as an admin...

 

I thought there was only one option and that was to just view the site as anyone would?

kandasmukandasmu

Setup>Develop>Sites> Select a site, and you can see "preview as admin"....

admintrmpadmintrmp

Ah! Okay - Got the following error:

 

An error has occurred while processing your request. We apologize for the inconvenience. Error ID: 2134096678-2176 (-380718662)

 

Which is pretty useless overall.


I am calling this static resource from a PageReference in my apex code:

 

 

PageReference pr = new PageReference('/resource/'+resourceFile+'/html/siteFooter.html');
return pr.getContent().toString();

 

 

RyanGuestRyanGuest

I've passed along this issue to the salesforce technology team.

 

Feel free to contact salesforce support (support@salesforce.com) and log a case for more frequent updates.

admintrmpadmintrmp

I do not have developer support. Is that required to track this and see what the cause of this is?