Monday, February 3, 2020

How to check current user is guest user or not in lightning web components(lwc)

To check the current user is a guest user, import the current user’s status from @salesforce/user/isGuest

import isGuestUser from '@salesforce/user/isGuest';
isGuestuser identifier provides the guest user information if it returns true the current is a guest user or if it returns false current user not a guest user

        <div class="slds-m-around_medium">
            <p>Current User is guest or not:  <b>{isGuestUser}</b></p>  

Javascript Controller
import { LightningElement } from 'lwc';
import isGuest from '@salesforce/user/isGuest';

export default class currentUserInfo extends LightningElement {
    isGuestUser = isGuest;


No comments:

Post a Comment