I'm fiddling around with writing a Chrome Extension for Force.com and came across the following blog post (http://th3silverlining.com/2013/09/14/developing-chrome-extensions-for-salesforce/). I downloaded the source and starting playing around, and noticed that everything seemed to work fine with the following query using ForceTK:

SELECT Count() FROM Case

However, when I replaced that query with the following, I started getting 400 Requests and CrossDomain issues:


I tried looking around a bit but couldn't determine why one type of query was permissible but the other wasn't.

I ended up extracting out part of the code for testing, so my contentscript.js file ended up looking like the following:

function getValueFromCookie(b) {
    var a, c, d, e = document.cookie.split(";");
    for (a = 0; a < e.length; a++)
        if (c = e[a].substr(0, e[a].indexOf("=")), d = e[a].substr(e[a].indexOf("=") + 1), c = c.replace(/^\s+|\s+$/g, ""), c == b) return unescape(d)

var client = new forcetk.Client();

// client.query("SELECT Count() FROM CASE", function(response){
client.query("SELECT Id, Name FROM CASE", function(response){

EDIT: Adding picture of the Chrome Developer Console.

Chrome Developer Console

  • Are you sure the 400 and cross domain errors both occur only with modified query? In any case, you can override the default proxy behavior force.tk using the solution suggested on this thread - salesforce.stackexchange.com/questions/12664/… – Gaurav Kheterpal Dec 26 '13 at 10:00
  • Yeah, the actual error that comes back is a 400 in my Chrome developer console, but if you expand if you can see a Cross Domain issue. I'll append a picture of that to the question. – Michael Welburn Dec 26 '13 at 14:53
  • @GauravKheterpal I just tried this out, unfortunately I get the same error (though with a different URL for the GET request) - na15.salesforce.com/services/data/v27.0/… – Michael Welburn Dec 26 '13 at 15:15
  • Interesting. I was originally thinking that you are getting a timeout on the proxy with your other Select query but that doesn't seem to be the case. I would suggest that you post a comment on the original thread or reach out to Wes Nolte on this. He may have dealt with this earlier. – Gaurav Kheterpal Dec 26 '13 at 16:38

I didn't catch that I was querying on a non-existent field (Name on Case)...once I used an actual attribute, things worked again :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.