We use Javascript Remoting to retrieve some complex data from the controller. The SOQL query looks like the following:

    ( SELECT Id, Sales_Rep__r.Name, Customer__r.Name,
    Customer__r.FirstName, Customer__r.LastName,
    Customer__r.ShippingStreet, Customer__r.ShippingCity,
    Customer__r.ShippingState, Customer__r.ShippingPostalCode,
    Customer__r.PersonHomePhone, Customer__r.PersonMobilePhone,
    FROM Bookings__r  
    WHERE (Sales_Rep__r.Territory__c = :region OR Region__c = :region ) AND (
    Status__c = 'Pending' OR Status__c = 'Confirmed' ) )

FROM Timeslot__c WHERE Date__c >= :fromDate AND Date__c <= :toDate

It worked perfectly until last weekend (25 May 2013). Since then, the Sales_Rep__r property of Booking__c child records in the returned Timeslot__c is sometimes undefined even though the corresponding Sales_Rep__c contains the correct id.

We were able to recreate it with a barebone test page with no javascript library at all, just the JS remoting call to the backend. In addition, we were able to see the correct data in the Apex debug log just before it is sent out. So the problem definitely lies with the JS remoting library.

This issue happens on the latest versions of Firefox, Chrome, IE. Only Firefox 20 and Safari continue to work fine.

I'm wondering if anyone else experiences the same issue or if anyone can give any pointer to help resolve it?

Update: The SOQL result is converted into a map and passed straight to the front-end. The code for the test page on the front-end goes like this:

window.onload = function(){
  BookingCtrl.getTimeslots( '2013-05-28', '2013-05-28', 'Brisbane North',
    function( result, event ) {  
      _.each(_.values(result), function(slot){
        if (slot.Bookings__r)
          _.each(slot.Bookings__r, function(booking){
            if(booking.Sales_Rep__r == undefined)

The Sales Rep record that goes missing is no different from other user records (no special characters, etc.) That same Sales Rep shows up in some other bookings. So I would rule out the possibility that it is the cause of the problem.

  • Some code would be helpful. Commented May 28, 2013 at 7:51
  • 1
    You mention that the Sales_Rep__r is only sometimes undefined. I'd check the Name and Territory__c values for the problem Sales Reps. See if there are any differences from those records that work. Look for things like a single quote or other characters that would need to be escaped in JavaScript. Commented May 28, 2013 at 23:52
  • 6
    @MartinBorthiry the AJAX toolkit and javascript remoting are two very different things. Commented May 29, 2013 at 3:50
  • 5
    Just out of curiosity; has this been fixed? What was the problem? Commented Jul 3, 2013 at 8:24
  • 1
    @MarkPond No. The SF support guy is not the sharpest tool in the shed, to put it mildly. But it's not a big problem since we have a workaround by using Firefox 20. Commented Aug 21, 2013 at 4:41

2 Answers 2


When you use ajax toolkit , it is just a rest callout and you just send query as a data. So there should no impact of browser as all browser support Ajaxrequest.

There may be following problems :

1) check the all related fields and objects security settings and accessibility setting. 2) You will be able to see query result in apex class controller if you write class without sharing.


Could it be an escape JSON issue. If salesforce apex data to JSON binding, layer does not escape JSON special characters while serialising the apex map to your large JSON.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .