• 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’)

Blog Stats

  • 147,620 hits

Archives

Recent Posts: Salesforce Everywhere

Explore My New Services on SFDC SmartMindz:)

Expert Salesforce Solutions from a Turnaround Master :)

Einstein GPT

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

Using Dynamic Actions

Connect with me

  • View @manibalan_s’s profile on Twitter
  • LinkedIn

Follow this Blog via Email

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

Powered by WordPress.com.

Loading Comments...