I have Managed Package which is installed in my Dev Org.
This package contains some Apex Methods which I want to import into my LWC in the Dev Org.
The Apex Class and Method marked as global
in the Package org.
global class GlobalUtility {
global static Boolean isUserLicenced(Id userId) {
Boolean isUserLicenced = false;
// do some logic
return isUserLicenced ;
}
}
However I still can't import them into my LWC, i have tried different variants:
// should be the correct one
import isUserLicenced from '@salesforce/apex/packageName.GlobalUtility.isUserLicenced';
// however it gives "Unable to find Apex action method referenced as 'packageName.GlobalUtility.isUserLicenced'." error
// not working as it search for local classes
import isUserLicenced from '@salesforce/apex/GlobalUtility.isUserLicenced';
// not working as it search for local "packageName__GlobalUtility" class
import isUserLicenced from '@salesforce/apex/packageName__GlobalUtility.isUserLicenced';
In the docs: Component Namespaces, I see that:
A custom Lightning web component can't access a Lightning web component or module in a custom namespace when running in an org that’s using Lightning Locker instead of Lightning Web Security
I do have Lightning Web Security enabled !!
However it is about other LWC's and modules from package, not about Apex Classes !!
So my Question is:
Can we import Apex method from Managed Package into our local LWC ??
Any help will be appreciated,
thanks