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
beginner apexbeginner apex 

why we use bulkfy trigger in salesforce

hi ,

 

why we go for an bulkifu trigger , and i need some explaination , den what is the difference between trigger and bulkify trigger

 

 

 

Regards,

 ganesh

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Batch size is the number of records that will be processed in a single transaction - in the data loader when running in non-bulk mode you can set this between 1 and 200 records.

 

Batch jobs are apex that is run in batch mode, allowing up to 50 million records to be processed by a single job. They are a way of breaking up the processing of huge amounts of data into discrete transactions.

 

Data loader is just another mechanism for getting data into the system - it allows you to create multiple records in one go, unlike the standard UI which allows you to create one record at a time.

All Answers

Yoganand GadekarYoganand Gadekar

Hi,

 

Bulkified trigger is the one which operates on bulk of records at a time. You need to bulkyfy trigger because sometimes you may use data loader or other tools to insert/update/delete lot of records at a time.

 

Thanks,

Salesforce knwoledge sharing at :

CloudForce4u

bob_buzzardbob_buzzard

You bulkify triggers so that you can process a number of records in a single trigger execution without breaching governor limits.

 

The classic situation is where you need to retrieve records related to the trigger.  For example, you have a trigger that works on contacts and you need to pull back the associated accounts.  If you iterate the contacts and query the accounts one at a time, you will break the maximum number of SOQL statements if you have more than 100 records.  Thus you would bulkify, by placing all of the account ids into a set and querying those back via a single SOQL statement. You can then store the results in a map keyed by account id, iterate the contacts and access the associated account based on its id.

beginner apexbeginner apex

Thanks a lot ,

 

what is the difference between batch size , batch job and data loader using bulkify trigger in salesforce

bob_buzzardbob_buzzard

Batch size is the number of records that will be processed in a single transaction - in the data loader when running in non-bulk mode you can set this between 1 and 200 records.

 

Batch jobs are apex that is run in batch mode, allowing up to 50 million records to be processed by a single job. They are a way of breaking up the processing of huge amounts of data into discrete transactions.

 

Data loader is just another mechanism for getting data into the system - it allows you to create multiple records in one go, unlike the standard UI which allows you to create one record at a time.

This was selected as the best answer
beginner apexbeginner apex
Thanks lot Bob
beginner apexbeginner apex

trigger tiggercon on Account (before insert , before update)
 {
   for(Account a : trigger.new)
   {
    List<Contact> contact = [SELECT   id , FirstName , LastName , Email  
    FROM Contact WHERE  accountId = : a.Id];
     for(Contact c : contact)
     {
         System.debug ('contact id [' + c.id + '] , FirstName[' + c.FirstName + '] , LastName[' + c.LastName + ']');
         c.Description = c.FirstName + ' ' + c.LastName ;
          update c;
      }
    }
}

 

i worte the code in account object , den created account and contact ,

 

once i saved contact field but it never shows the description box in the firstname and lastname

 

can u help me what problem ll happen

 

 

Regards,

Ganez

bob_buzzardbob_buzzard

If you created the account and then the contact, the trigger won't fire when you create the contact, as its on an account.  You'd need to update the account to get it to process the new contact.