• About
  • Contact me!

Salesforce Everywhere

~ Blog on Salesforce Dev and admin stuff

Salesforce Everywhere

Tag Archives: UserLicense

Tip#17 – Accessing “User License” field on User Object

07 Monday Dec 2015

Posted by Mani in Salesforce Configuration

≈ Leave a comment

Tags

UserLicense

If you want to access User license field which determines the type of license that user is on(ex: Salesforce, Salesforce Platform etc), you can access it in apex  as follows:

User.Profile.UserLicense.Name

Suppose, you want to create a validation rule in User object to make a custom field mandatory based on the license, it could be as follows,substitute Customfield with the actual field name(API name):

AND(ISNEW(),ISBLANK(Customfield), OR(Profile.UserLicense.Name=’Salesforce’,Profile.UserLicense.Name=’Salesforce Platform’)

Advertisement

Blog Stats

  • 114,773 hits

Archives

Recent Posts: Salesforce Everywhere

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

Lightning component to filter Products and display results in lightning data table

Connect with me

  • View @manibalan_s’s profile on Twitter
  • LinkedIn

Developer links

  • Salesforce Developer website
  • Salesforce Success Community

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.

  • Follow Following
    • Salesforce Everywhere
    • Already have a WordPress.com account? Log in now.
    • Salesforce Everywhere
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar