Skip to main content
Tweeted twitter.com/#!/StackSalesforce/status/244677265621934081
edited tags
Link
ca_peterson
  • 23.2k
  • 7
  • 70
  • 123
added 145 characters in body; edited title
Source Link
metadaddy
  • 16.5k
  • 5
  • 57
  • 103

Javascript JavaScript Remoting on Standard Page Layout

I have a couple javascriptof JavaScript remoting functions used to count records and to display that count to the end user. The javascriptJavaScript remoting functions are on a visual forceVisualforce page, and the visual forceVisualforce page is embedded on a page layout of a custom object.

What is happening is that the javascipt remoting functions are supposed to count the number of records available after filters are set. However intermittently the user will receive the error “Unable to connect to server”.

I have a couple of javascriptJavaScript remoting functions are working against a custom object, and there are other remoting functions working on the Task object. These functions are doing nothing more than counting records in the system. The javascriptJavaScript remoting function counting records on the Task object are working more constistently than the javascriptJavaScript remoting functions counting records on the custom object.

I’m worried that this error may a result of the fact that the custom object is not indexed, and therefore counting records for that object may require more time than what is allowed for javasciptJavaScript remoting functions. If this is the case, should I do something to get the custom object indexed?

Also, I’m concerned that the “Unable to connect to server” error is a known bug, from what I have gathered on the forums. If this is the case is there a known fix?

Below is an example of the JavascriptJavaScript remoting function on the Task object, to count the number of task records for the given parameters. This function is failing some of the time, mostly in the morning when first logging into the system.

//Javascript Remoting Function
controllerExampleCounter.asyncReviewedClosed(String("{!Example_Custom_Setting_Validation__c.OwnerId}"), function(result, event)
  {
    if (event.status)
  {
        $("#reviewedClosed").text(addCommas(result));
    } 
 else if (event.type === "exception") 
 {
        $("#reviewedClosed").text("Error: " + event.message);
    } 
 else 
 {
        $("#reviewedClosed").text("Error: " + event.message);
    }
}, {escape:true});
 

//Apex Function
@RemoteAction @ReadOnly
global static Integer asyncReviewedClosed(String owner_id)
{
    Integer incomplete = 0;

    try{
        incomplete = [Select count() 
            From Task 
            Where RecordType.Name = 'Qualification Task' And
                And CreatedById = :String.escapeSingleQuotes(owner_id) 
                And IsClosed = true 
                And CreatedDate = THIS_YEAR];
    } catch(Exception e) {
    }

    return incomplete;
}

Javascript Remoting on Standard Page Layout

I have a couple javascript remoting functions used to count records and to display that count to the end user. The javascript remoting functions are on a visual force page, and the visual force page is embedded on a page layout of a custom object.

What is happening is that the javascipt remoting functions are supposed to count the number of records available after filters are set. However intermittently the user will receive the error “Unable to connect to server”.

I have a couple of javascript remoting functions working against a custom object, and there are other remoting functions working on the Task object. These functions are doing nothing more than counting records in the system. The javascript remoting function counting records on the Task object are working more constistently than the javascript remoting functions counting records on the custom object.

I’m worried that this error may a result of the fact that the custom object is not indexed, and therefore counting records for that object may require more time than what is allowed for javascipt remoting functions. If this is the case, should I do something to get the custom object indexed?

Also, I’m concerned that the “Unable to connect to server” error is a known bug, from what I have gathered on the forums. If this is the case is there a known fix?

Below is an example of the Javascript remoting function on the Task object, to count the number of task records for the given parameters. This function is failing some of the time, mostly in the morning when first logging into the system.

//Javascript Remoting Function
controllerExampleCounter.asyncReviewedClosed(String("{!Example_Custom_Setting_Validation__c.OwnerId}"), function(result, event)
 {
if(event.status)
 {
$("#reviewedClosed").text(addCommas(result));
} 
 else if (event.type === "exception") 
 {
$("#reviewedClosed").text("Error: " + event.message);
} 
 else 
 {
$("#reviewedClosed").text("Error: " + event.message);
}
}, {escape:true});
 

//Apex Function
@RemoteAction @ReadOnly
global static Integer asyncReviewedClosed(String owner_id)
{
Integer incomplete = 0;

try{
incomplete = [Select count() From Task Where RecordType.Name = 'Qualification Task' And     CreatedById = :String.escapeSingleQuotes(owner_id) And IsClosed = true And CreatedDate = THIS_YEAR];
}catch(Exception e){}

return incomplete;
}

JavaScript Remoting on Standard Page Layout

I have a couple of JavaScript remoting functions used to count records and to display that count to the end user. The JavaScript remoting functions are on a Visualforce page, and the Visualforce page is embedded on a page layout of a custom object.

What is happening is that the javascipt remoting functions are supposed to count the number of records available after filters are set. However intermittently the user will receive the error “Unable to connect to server”.

I have a couple of JavaScript remoting functions are working against a custom object, and there are other remoting functions working on the Task object. These functions are doing nothing more than counting records in the system. The JavaScript remoting function counting records on the Task object are working more constistently than the JavaScript remoting functions counting records on the custom object.

I’m worried that this error may a result of the fact that the custom object is not indexed, and therefore counting records for that object may require more time than what is allowed for JavaScript remoting functions. If this is the case, should I do something to get the custom object indexed?

Also, I’m concerned that the “Unable to connect to server” error is a known bug, from what I have gathered on the forums. If this is the case is there a known fix?

Below is an example of the JavaScript remoting function on the Task object, to count the number of task records for the given parameters. This function is failing some of the time, mostly in the morning when first logging into the system.

//Javascript Remoting Function
controllerExampleCounter.asyncReviewedClosed(String("{!Example_Custom_Setting_Validation__c.OwnerId}"), function(result, event) {
    if (event.status) {
        $("#reviewedClosed").text(addCommas(result));
    } else if (event.type === "exception") {
        $("#reviewedClosed").text("Error: " + event.message);
    } else {
        $("#reviewedClosed").text("Error: " + event.message);
    }
}, {escape:true});

//Apex Function
@RemoteAction @ReadOnly
global static Integer asyncReviewedClosed(String owner_id)
{
    Integer incomplete = 0;

    try{
        incomplete = [Select count() 
            From Task 
            Where RecordType.Name = 'Qualification Task' 
                And CreatedById = :String.escapeSingleQuotes(owner_id) 
                And IsClosed = true 
                And CreatedDate = THIS_YEAR];
    } catch(Exception e) {
    }

    return incomplete;
}
Source Link
Tony H.
  • 206
  • 1
  • 3
  • 5

Javascript Remoting on Standard Page Layout

I have a couple javascript remoting functions used to count records and to display that count to the end user. The javascript remoting functions are on a visual force page, and the visual force page is embedded on a page layout of a custom object.

What is happening is that the javascipt remoting functions are supposed to count the number of records available after filters are set. However intermittently the user will receive the error “Unable to connect to server”.

I have a couple of javascript remoting functions working against a custom object, and there are other remoting functions working on the Task object. These functions are doing nothing more than counting records in the system. The javascript remoting function counting records on the Task object are working more constistently than the javascript remoting functions counting records on the custom object.

I’m worried that this error may a result of the fact that the custom object is not indexed, and therefore counting records for that object may require more time than what is allowed for javascipt remoting functions. If this is the case, should I do something to get the custom object indexed?

Also, I’m concerned that the “Unable to connect to server” error is a known bug, from what I have gathered on the forums. If this is the case is there a known fix?

Below is an example of the Javascript remoting function on the Task object, to count the number of task records for the given parameters. This function is failing some of the time, mostly in the morning when first logging into the system.

//Javascript Remoting Function
controllerExampleCounter.asyncReviewedClosed(String("{!Example_Custom_Setting_Validation__c.OwnerId}"), function(result, event)
{
if(event.status)
{
$("#reviewedClosed").text(addCommas(result));
} 
else if (event.type === "exception") 
{
$("#reviewedClosed").text("Error: " + event.message);
} 
else 
{
$("#reviewedClosed").text("Error: " + event.message);
}
}, {escape:true});


//Apex Function
@RemoteAction @ReadOnly
global static Integer asyncReviewedClosed(String owner_id)
{
Integer incomplete = 0;

try{
incomplete = [Select count() From Task Where RecordType.Name = 'Qualification Task' And     CreatedById = :String.escapeSingleQuotes(owner_id) And IsClosed = true And CreatedDate = THIS_YEAR];
}catch(Exception e){}

return incomplete;
}