Step1: Create LWC component after creating project in vs code.
Step2: Create a class in APEX CLASS and paste the below code.
public with sharing class apiCall {
@AuraEnabled(cacheable=true)
public static string ConvertFile() {
system.debug('hello testing');
return 'testing';
}
}
Step3: Paste the below HTML to the HTML file of LWC.
On clicking on the button Load Accounts it will call the handleLoad event defined in the JS file.
<template>
<lightning-card>
<lightning-button label="Load Accounts" onclick={handleLoad} ></lightning-button>//using onclick event handler to call Js Method
</lightning-card>
</template>
Step4: Paste the below JS to the JS file of LWC.
This Js is calling the Apex class method and printing the returned result from the method of the apex class.
import { LightningElement,wire } from 'lwc';
import ConvertFile from '@salesforce/apex/apiCall.ConvertFile' //importing method of apex class to js
export default class Al3JsonConvert extends LightningElement {
@wire(ConvertFile ) apexMethod; //calling apex class method
handleLoad() {
ConvertFile().then(result => {
//console.log('daya');
console.log(result);
}) .catch();
}
}
People having good knowledge of Financial accounting can get an Accounting Certification from StudySection to increase their chances of getting a job in this field. You can get a foundation level certification if you are new to Financial accounting or you can go for advanced level certification if you have expert level skills in Financial accounting.