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
ksswaksswa 

Trigger to update record count that meets criteria

I'm sure this is much, much easier than I am ascribing to it...for some reason I am unable to vision my way into a first venture into APEX code.

 

I have read and read and read posts and have found a multitude that seem like they should be close but I can never quite transform them.  At now that I have hit 7 hours of reading and have made no progress I have to concede and ask for help.

 

I need a "fake" roll-up summary (I have created a field called "Trained Contacts" on my Account object that counts related Contacts when custom field "Date_of_Last_Implantation_Training__c" is not equal to null.  It has to recalculate when Contacts are added and that field is filled in, when Contacts are deleted (and therefore the count should go down) or when the contents of that field are deleted (rare, but usually only when there is a data entry error).

 

Anyone out there that can help me through my first Trigger?  I'm sure I can then study the code and then adapt if for other future uses if necessary (although we have made it 2 years without needing any heavy customization yet...).

 

Thank you in advance for your patience and any assistance you may be able to offer...

 

Kelly

Best Answer chosen by Admin (Salesforce Developers) 
UmapenUmapen

How can I add status condition and maintain two counts for total list?

appreicate any suggestions?

Message Edited by Umapen on 10-05-2009 02:06 PM

All Answers

jeffdonthemicjeffdonthemic

Kelly,

 

I just wrote a blog post about this the other day. Please see the following two posts:

 

 

 

 

 

HTH

 

Jeff Douglas

Appirio

http://blog.jeffdouglas.com 

UmapenUmapen

How can I add status condition and maintain two counts for total list?

appreicate any suggestions?

Message Edited by Umapen on 10-05-2009 02:06 PM
This was selected as the best answer