Need a help in Lightning Web Components. I am working on an assignment where I need to get some values from the UI, populate it on an inner class variables defined in an Apex class and then make a web service call. I have built the UI portion with local variables and I see that it is working.
My class definition is something like the one shown below.
public class TaskHeader {
@AuraEnabled public String taskName;
public class TaskDetails {
@AuraEnabled public String taskDetailName;
@AuraEnabled public Integer taskDetailSeq;
@AuraEnabled public String taskDescription;
}
}
In the .js file, I am not sure how to import these variables. I tried the following solutions and it did not work.
import TASKNAME_FIELD from '@Salesforce/schema/TaskHeader.taskName';
import TASKDETAIL_FIELD from '@Salesforce/schema/TaskHeader.TaskDetails.taskDetailName';
import TASKDETAILSEQ_FIELD from '@Salesforce/schema/TaskHeader.TaskDetails.taskDetailSeq';
import TASKDESCRIPTION_FIELD from '@Salesforce/schema/TaskHeader.TaskDetails.taskDescription';
I tried replacing the schema with apex and it did not work either. I am getting the below error message when I try to deploy the source into the Org.
> force-app/main/default/lwc/TaskComponent/TaskComponent.js Exception
> while getting the LWC bundle for reference
> @Salesforce/schema/TaskHeader.TaskDetails.taskDetailName of type
> module in file TaskComponent.js
Can someone help?
Below is the sample code for the Apex method that calls the Soap API.
@AuraEnabled
public static String createTask(String strAction) {
}
It is a Soap API and hence strAction contains the Envelope and the Body of the message which contains the info about the TaskHeader and TaskDetails.
@AuraEnabled
unless you send data TO the component. Try calling apex, and let us know if you get stuck trying to do so.