I have a trigger code on account which prevents user to create or update any account that contains \ character in the name.

trigger Restrictbackslashname on Account (before Insert,before Update){

List <Account> acclist = new List<Account>();

for(Account act:Trigger.New){


act.adderror ('You can not enter any account or update that contains backslash character');



Just wanted to verify does the above trigger follow best practice of Apex trigger and is it bulkified?

2 Answers 2


Bulkify a trigger means avoiding SOQL, DML query in loops because it exceeds governor limits... In your code you are not using SOQL or DML query in Loops. And in your code you don't need to use acclist.add(act); as it would work expect acclist.add(act); also..


As Amit says, both references to acclist are redundant and can be removed.

In terms of best practices, I suggest the following:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .