I'm trying to create an onclick to execute an apex action
import { LightningElement,wire} from 'lwc';
import getClass from "@salesforce/apex/SchedulableClasses.SchedulableClasses";
import setPlan from "@salesforce/apex/Plan.Plan";
export default class LightningExampleInputDateTime extends LightningElement {
@wire (getClass) apexclass;
handleClick(){
@wire(setPlan,{jobName:'Test',d:'0 0 13 * * ?',scheduleName:'PlanTest'}) jobId;
}
}
I know the handleClick function is wrong but i can't find another method to call an apex action without using @wire
public class Plan {
@AuraEnabled(cacheable=true)
public static string Plan(String jobName, String d, String scheduleName) {
String jobId;
Type scheduleClass = Type.forName(scheduleName);
if (scheduleClass != null) {
Schedulable m = (Schedulable) scheduleClass.newInstance();
jobId = system.schedule(jobName, d, m);
}
return jobId;
}
}