I have an Invocable Apex Method which I am using in a Flow and I want to call from my LWC.
I have created a separate AuraEnabled Method to call the Invocable method.
public with sharing class CustomerOrg_Helper {
@AuraEnabled(cacheable=true)
public static List<CustomerOrg_Controller.Response> customerOrgLogin (string customerOrgId) {
CustomerOrg_Controller.Request curRequest = new CustomerOrg_Controller.Request();
curRequest.CustomerOrgId = customerOrgId;
List<CustomerOrg_Controller.Request> curRequests = new List<CustomerOrg_Controller.Request>();
curRequests.add(curRequest);
List<CustomerOrg_Controller.Response> curResponses = CustomerOrg_Controller.execute(curRequests);
System.debug('Response:' + curResponses);
return curResponses;
}
}
When I run the Anonymous Apex Script below I receive the expected results..
List<CustomerOrg_Controller.Response> data =
CustomerOrg__Helper.customerOrgLogin('a8i3G0000008ONZQA2');
System.debug('Results ' + data[0].status);
Debug = (Response:[Url=https://test.com, status=OK])
I am unable to translate this to my LWC and return the status value using the code below. The console is returning Undefined
@wire(getCustomerOrg, {customerOrgId: '$recordId'})
WiredLogin ({data}) {
if (data) {
console.log('Customer Org ' + data[0].status);
}
}
console.debug(JSON.parse(JSON.stringify(data))
to get around the proxies.