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
Nilesh ManeNilesh Mane 

Urgent : Bulkify this apex class. How to bring these queries outside of FOR loop?

HI Everyone,

 

I want to remove queries from for loop and want to bulkify my apex class, so that it wont hit governor limits.

 

Navatar_DbSupNavatar_DbSup

Hi,


Please go through the link to know about how to bulkily the class and trigger.
http://wiki.developerforce.com/page/Apex_Code_Best_Practices

Nilesh ManeNilesh Mane

Thanks for responding...

I know this link..... I tried like that also but got failure....

I want to run this code for all event users, i need to check values for all users and then insert records for them.

Just tell me how i can remove this queries from for loop....

 

Regards,

Nil

bobo

You have asked an extremely general question, and you received a reply directing you to the best practice. If you are having trouble understanding the best practice, you need to post some of your code here before you can get more help.

 

Before you post your code, though, two suggestions.

 

  1. Simplify your code; make it ten lines or less if you can. 
  2. Make sure to use the Code insert widget (it looks like this:code insert). That will ensure that the formatting of your code is preserved. Otherwise, it will be all broken and hard to read, so people are not likely to want to take the time to figure out what the code says.