You need to sign in to do that
Don't have an account?

custom setting trigger firing for all users.
i want to run this code only for system admin. But it is firing for all users.
trigger acc_customSetting on Account (before insert) { adminonly__c a1=adminonly__c.getInstance(userinfo.getuserid()); if(a1.valid__c) { for(account a2:trigger.new) { a2.description=a2.name+' this is custom setting data'; } } }
Assuming you have already created the custom settings records and that this custom setting is of hierarchy type, it should be something like this:
As you can see it is almost as you had it. Give it a try and let me know if it worked, but check before what I told before, hierarchy custom setting type and custom setting records existing for that profile.
Regards