+ Start a Discussion
Sid_CSid_C 

Using Ajax toolkit for communities VF page

I have a VF page which retrieves a custom object data using the ajax toolkit. I am using this VF page within a community as well as in the internal org. This page loads fine in the internal org, but within the community i get the below error message.  

POST https://xxxxx.force.com/services/Soap/u/29.0 500 (Internal Server Error) connection.js:594
Uncaught {faultcode:'UNKNOWN_EXCEPTION', faultstring:'UNKNOWN_EXCEPTION: Site under construction', } connection.js:1014

To fix this i've copied the connection.js in the VF page, and added the site prefix global variable where the server url is being set in the connection.js.

Is this a bug within the toolkit? Or is there a better way to handle this, as i don't want to copy the connection.js inside the Vf?

Best Answer chosen by Sid_C
Sid_CSid_C

Discussed this with Salesforce Support. Ajax toolkit does not work on communities and standalone force.com sites.

Vote on this idea for better support for Force.com Sites. https://success.salesforce.com/ideaView?id=08730000000KMKsAAO

All Answers

George thomasGeorge thomas
Try using earlier version of ajax tool kit..i remember i too had some issue like same so i used "/soap/ajax/28.0/connection.js" to overcome the exception.
Sid_CSid_C
Tried with version 28, got the same error.
Sid_CSid_C

Discussed this with Salesforce Support. Ajax toolkit does not work on communities and standalone force.com sites.

Vote on this idea for better support for Force.com Sites. https://success.salesforce.com/ideaView?id=08730000000KMKsAAO

This was selected as the best answer