Handling the Remote Response
- event object representing the status of the remote call
- result object returned by the remote Apex method.
Field | Description |
---|---|
event.status | true on success, false on error. |
event.type | The type of the response: rpc for a successful call, exception if the remote method threw an exception. |
event.message | Contains any error message that is returned. |
event.where | The Apex stack trace is referenced, if it is generated by the remote method. |
Apex primitive data types returned by result—such as strings or numbers—are converted to their JavaScript equivalents. Apex objects that are returned are converted to JavaScript objects, while collections are converted to a JavaScript array. Keep in mind that JavaScript is case-sensitive, so id, Id, and ID are considered different fields.
As part of a JavaScript remote call, if the Apex method response contains references to the same object., the object is not duplicated in the returned JavaScript object. Instead, the rendered JavaScript object contains a reference to the same object. An example is an Apex method which returns a list that contains the same object twice.