function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SelvaSelva 

how to check the profile thru trigger

Hi,
 
Is it possible to check the user who is performing update on any account pages is System Administrator or something else?
I used the below code but failed to show the particular user role who is performing the  update on each Account page. It keeps getting changed,when i do update as the same role(system admin)
Code:
trigger tocAccountTrigger on Account (before update) {
for (Profile p : [select name from Profile])
if(p.name=='System Administrator')
{
//do something
}
}

 
ppatppat
use Profile Id. UserInfo.getProfileId()

Look for the documentation under UserInfo