0
import { LightningElement, wire } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';

export default class CheckPermission extends LightningElement() {

    areAccountVisible = false;

        @wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })

        wiredData({data, error}){

            if(data){
     
                this.areAccountVisible = data.queryable;
            }
     
            if(error){
     
            }
         }
}
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • Yes you can check like this too, but if you are using apex to do DMLs then you will have to do a check on Apex too. Also you need to write your logic after this.areAccountVisible = data.queryable; only, as wire methods are async in nature. Jun 23 at 5:58
  • Thanks for the confirmation @NagendraSingh
    – John
    Jun 24 at 3:16

0

Your Answer

John is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.