I have an apex method which basically checks if user has create access on Custom Object or not. Based on that it just returns true or false. If user has create permission in that case it's returning the true value but if I remove the create permission its not returning any value. In debug log I can see the Apex Method is called but noting in the lwc side.
As of now I'm calling my method on connectedCallback() where its working.
But I'm not able to understand why it's not returning any value when user doesn't have Object create permission.
Lwc.js
@wire(isObjectCreateable)
isObjectCreate({ error, data }) {
if (data) {
this.isObjectCreatePermission = data;
this.error = undefined;
console.log(">>> isProposalCreatePermission : " + this.isObjectCreatePermission );
} else if (error) {
this.error = error;
this.isObjectCreatePermission = false;
console.log(">>> isProposalCreatePermission : " +error);
}
}
Apex:
@AuraEnabled(cacheable=true)
public static Boolean isProposalCreateable(){
SObjectType schemaType = Schema.getGlobalDescribe().get('Object__c');
system.debug('>>> isProposal Createable '+schemaType.getDescribe().isCreateable());
return schemaType.getDescribe().isCreateable();
}
Debug Log:
- User Has Permission:
b. Console log: