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.


    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);


    public static Boolean isProposalCreateable(){
        SObjectType schemaType = Schema.getGlobalDescribe().get('Object__c');
        system.debug('>>> isProposal Createable '+schemaType.getDescribe().isCreateable());
        return schemaType.getDescribe().isCreateable();

Debug Log:

  1. User Has Permission:

enter image description here a. apex:

b. Console log:

enter image description here

  1. User Does not have permission: a. apex: b. Nothing in console log enter image description here
  • Can you add what the debug logs look like? (both JS and apex) Commented Apr 22, 2020 at 16:34
  • In case user does not have access both the console logs are not getting executed where as in debug log I'm getting false value Commented Apr 22, 2020 at 16:35
  • In case user has access to object, I can see console log on data check condition Commented Apr 22, 2020 at 16:37
  • Please show the logs instead of asking us to guess Commented Apr 22, 2020 at 16:37
  • 2
    I think you can achieve this without having to write apex, using the getObjectInfo wire module, developer.salesforce.com/docs/component-library/documentation/… Commented Apr 22, 2020 at 16:55

1 Answer 1


So let's consider your code

isObjectCreate({ error, data }) {
    if (data) {    
    } else if (error) {
        //other stuff

If your Apex returns false, data= false and thus if(data) isn't true. But the method didn't fail, so error isn't defined either. Since you're returning a boolean I'd change it to

if (data != null && data != undefined) {

See if that works!

It's important to note also that returning a 0 value also compares as false, so if you know your return value can be 0 or false or an empty string, you should check for not null or not undefined instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .