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
NikithaNikitha 

Hey can anyone tell me I'm new to salesforce. How we can query bulk triggers in anonymous window?

Malika Pathak 9Malika Pathak 9

Hi Swathi,

please find the solution

run this code in the anonymous window for inserting account

List<Account> acclist=new List<Account>();
for(integer i=0;i<10;i++){
    Account acc=new Account();
    acc.Name='test'+i;
    acclist.add(acc);
}
insert acclist;
If you find this solution is helpful for you please mark the best answer
ANUTEJANUTEJ (Salesforce Developers) 
Hi Swathi,

In case if you want to query all the triggers you can use the below soql query:

SELECT Id, Name, TableEnumOrId,UsageIsBulk FROM ApexTrigger where UsageIsBulk = true

The UsageIsBulk will Specify whether the trigger is defined as a bulk trigger (true) or not (false).

You can use query editor or in case if you are using anonymous window you can use the below lines:

list<ApexTrigger> apt= [SELECT Id, Name, TableEnumOrId,UsageIsBulk FROM ApexTrigger where UsageIsBulk = true];
system.debug(apt);

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
NikithaNikitha
Hey thanks for your help, but i have problem . Values inserted first time correctly though In second time I geeting err. my code is
List<Dupe_Customer_Detail__c> dupList= [Select Id, name, Last_Name__c
          from Dupe_Customer_Detail__c ];
                                  

for(integer i=0;i<3;i++){
   
 Dupe_Customer_Detail__c dup = new Dupe_Customer_Detail__c();
        dup.Name  = 'Harshi';
        dup.Last_Name__c ='A';
   
        dupList.add(dup);   
}
    insert dupList;  
and err is 
Line: 13, Column: 1
System.DmlException: Insert failed. First exception on row 0 with id a0A5g000000Ig9kEAC; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id] 
what i need to do please tell me