Newer Version Available

This content describes an older version of this product. View Latest

JavaScript Remoting Limits and Considerations

Although JavaScript remoting isn’t subject to some resource limits, it does come with limits of its own.

JavaScript remoting isn’t a way to avoid Salesforce service limits. JavaScript remoting calls aren’t subject to API limits, but Visualforce pages that use JavaScript remoting are subject to all standard Visualforce limits.

By default, the response of the remote call must return within 30 seconds, after which the call will time out. If your request needs longer to complete, configure a longer timeout, up to 120 seconds.

The request, including headers, has a maximum size of 4 MB.

The response of the remote call has a maximum size of 15 MB. If your JavaScript remoting code is exceeding this limit, you have several options:
  • Reduce the size of the response for each request. Only return data that’s required.
  • Break up large data retrieval into requests that return smaller chunks.
  • Make batched requests more frequently, reducing the size of each individual batch.
  • Use non-batched requests. Set { buffer: false } in your remoting request configuration block.

Salesforce logs error messages from some JavaScript remoting calls. You can prevent personal information from being logged by not including customer data in error messages. Instead, catch exceptions and log the full message. Then return a user-friendly message to your Visualforce page.