Is forcetk accessible in Communities

I am using forcetk to upload files (as Attachment records) in a VisualForce Page and it works fine. But when I access same page in a Community, I am not able to upload the file as I am getting the “503 Service Unavailable” in console. Is this proxy is accessible in communities?


I have a solution for this if you are willing to edit your copy of forcetk.js

find function: forcetk.Client.prototype.setSessionToken
leave it as is but at the end add:

this.instanceUrl = 'your community url';
this.proxyUrl = null;
this.visualforce = false;

This is a hack, there are ways to clean this up better, but this is the least intrusive modification I could pull off quickly.

I originally was using jsforce (which handles this nicely). Unfortunately, jsforce currently doesn’t support IE9 so that’s why I am here 🙂

Source : Link , Question Author : Shrivaths Kulkarni , Answer Author : Craig Johnson

Leave a Comment