runApex() for Salesforce Classic
Executes an Apex method from an Apex class that’s exposed in Salesforce.
| Name | Type | Description |
|---|---|---|
apexClass | string | Specifies the Apex class of the method to execute. |
methodName | string | Specifies the method to execute. |
methodParams | string | Specifies the method parameters to pass. The string must include field value pairs and be formatted as a valid query string. For example:name=acme&phone=(212) 555-5555. |
callback | function | JavaScript method executed when the API method call is completed. |
-
An administrator creates an Apex class and Apex method:
-
In the location where you’ve created the Apex class and method in Salesforce, click Generate WSDL to expose the method and class so that a third-party softphone can call it.
-
Add your code to the softphone:
-
Output is returned. In this example, one account named, Acme, was found:
| Name | Type | Description |
|---|---|---|
result | string | Returns the result from executing the method from the specified Apex class.No specific format is returned. The format is determined by the value from the method that was executed. |
error | string | If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message. |