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.

callApex()

Makes an Apex call.

Sample

Used within a JavaScript app uploaded as a static resource and referenced by lightning:container, this example calls the Apex method getAccount.
1callApex() {
2    LCC.callApex(
3        "lcc1.ApexController.getAccount",
4        this.state.name,
5        this.handleAccountQueryResponse,
6        { escape: true }
7    );
8}

When the Apex method you are calling doesn't require any parameters, pass an empty array.

1callApex() {
2    LCC.callApex(
3        "lcc1.ApexController.getAccountWithNoParams",
4        [], // Empty array for no parameters
5        this.handleAccountQueryResponse,
6        { escape: true }
7    );
8}

Arguments

Name Type Description
fullyQualifiedApexMethodName string The name of the Apex method.
apexMethodParameters array A JSON array of arguments for the Apex method.
callbackFunction function A callback function.
apexCallConfiguration array Configuration parameters for the Apex call.

Response

None.