I am using
forcetk
to upload files (asAttachment
records) in aVisualForce Page
and it works fine. But when I access same page in aCommunity
, 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?
Answer
I have a solution for this if you are willing to edit your copy of forcetk.js
https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit/blob/master/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 🙂
Attribution
Source : Link , Question Author : Shrivaths Kulkarni , Answer Author : Craig Johnson