You need to sign in to do that
Don't have an account?
salesforcesss_deveoper211
Get profile name in apex trigger
Hi,
Can we get $Profile.Name = "System Administrator" in apex trigger.
If no then how can I check if the current user is system admin or not.
Thaks.
do like this
id id1 = userinfo.getProfileId()
Then
select Name from profile where id = :id1;
Mark it as solution if it answered your question
1. define a formula field (named, say, "CurrentUserProfile) on an object that has this code:
$UserProfile.Name
2. In your trigger, you can just refer to the variable;
Hope this helps.... You can do the same for the Role name too.