You need to sign in to do that
Don't have an account?
SunnyShiny
Trigger check if current user is admin
Hello,
How can I check if the current user firing the trigger is admin or not?
Thanks
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hello,
How can I check if the current user firing the trigger is admin or not?
Thanks
You can get the current user's profile using UserInfo.getProfileId(). Then you can look up the profile name via SOQL and see if it is 'System Administrator'.
And if you just want to make sure that whatever the profile of the logged in user, the code should always run as system admin, try to use RunAs:
All Answers
compare with current user profile... is system administrator or not
You can get the current user's profile using UserInfo.getProfileId(). Then you can look up the profile name via SOQL and see if it is 'System Administrator'.
And if you just want to make sure that whatever the profile of the logged in user, the code should always run as system admin, try to use RunAs: