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}){

                this.areAccountVisible = data.queryable;
  • 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


Your Answer

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.