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.
callApex() {
LCC.callApex(
"lcc1.ApexController.getAccount",
this.state.name,
this.handleAccountQueryResponse,
{ escape: true }
);
}
When the Apex method you are calling doesn't require any parameters, pass an empty array.
callApex() {
LCC.callApex(
"lcc1.ApexController.getAccountWithNoParams",
[], // Empty array for no parameters
this.handleAccountQueryResponse,
{ escape: true }
);
}
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.