You need to sign in to do that
Don't have an account?

Need Apex code the mimics roll up feature
Hi,
I have a custom object called A with a lookup relationship (not master/detail) with custom object b. I can't use a roll up but I need to count how many B records for each A record and then just set a field on A with that number. This should be simple to do but I am missing some steps. How to set this up (I need apex code so I have a starting point)?
TIA,
I have a custom object called A with a lookup relationship (not master/detail) with custom object b. I can't use a roll up but I need to count how many B records for each A record and then just set a field on A with that number. This should be simple to do but I am missing some steps. How to set this up (I need apex code so I have a starting point)?
TIA,
Try this code, it will count the child record counts.