Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
API Call Syntax in the AJAX Toolkit
Synchronous Calls
Syntax:
1sforce.connection.method("arg1","arg2", ...);Example:
1sforce.connection.login("MyName@MyOrg.com","myPassword1");Asynchronous Calls
Syntax:
1method("arg1","arg2", ..., callback_method);Example:
1var callback = {onSuccess: handleSuccess, onFailure: handleFailure};
2function handleSuccess(result) {}
3function handleFailure(error) {}
4sforce.connection.query("Select name from Account", callback);In this example, onSuccess is the callback function, which returns the results when they are ready.
See Core Calls in the SOAP API Developer Guide for call usage, arguments, and best practices, but use the AJAX Toolkit syntax for methods you embed in JavaScript.