• About
  • Contact me!

Salesforce Everywhere

~ Blog on Salesforce Dev and admin stuff

Salesforce Everywhere

Tag Archives: Guest User check

How to check if the logged in user is a Guest user or not in APEX class?

08 Sunday Aug 2021

Posted by Mani in Uncategorized

≈ Leave a comment

Tags

APEX, Guest User check

To check if the logged in user is a Guest user or not in the APEX code, we can make use of the method isGuestUser() in Auth.CommunitiesUtil class where Auth is the namespace that provides an interface and classes for single sign-on into Salesforce and session security management.

        if(Auth.CommunitiesUtil.isGuestUser())
        {
            <call method X>
        }
        else
        {
            <call method Y>
        }

Also, there is a method isInternalUser() which returns true if the logged in user is an employee or the Internal user.

Hope this post is helpful!!

Blog Stats

  • 145,223 hits

Archives

Recent Posts: Salesforce Everywhere

Einstein GPT

How to get field values on onLoad in lightning-record-edit-form in LWC?

Using Dynamic Actions

How to check if the logged in user is a Guest user or not in APEX class?

How to Close Quick action in LWC

Connect with me

  • View @manibalan_s’s profile on Twitter
  • LinkedIn

Enter your email address and click on Follow us (below) to follow this blog and receive notifications of new posts by email.

Website Powered by WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • Salesforce Everywhere
    • Already have a WordPress.com account? Log in now.
    • Salesforce Everywhere
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar