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

How to skip trigger firing for community users


I want to bypass trigger for Community Users.
How to do this?
PratikPratik (Salesforce Developers) 
Hi Mayur,

Yes you can bypass the Community users from your trigger.

You need to write a conditional If statement that will exclude the Profile Id's of community users, i.e If user.profileId is not equls to community user's profile id (psudo code logic) then execute further statements in Trigger.


You can do it with the help of Hierarchy Custom Settings. You need to create a CheckBox Field DisableTrigger & one more field Text Type Objects which will contain the objects of which triggers you want to disable. Now, In Triggers you can use the following condition before the body of the trigger.

if(!(profileCustomSetting.Trigger_Objects__c.contains('Account') && profileCustomSetting.DisableTriggers__c)){
 //Your Trigge Body.


You can read more about this technique here (" target="_blank).

Important :

If this is what you were looking for then please mark it as a "SOLUTION" orYou can Click on the "Like" Button if this was beneficial for you.

Thank You