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
KeerthigeeKeerthigee 

Issue related to lead

Hi All,

I want to display total no of leads  created  in account object.Here,Account is parent object and lead -child object.

Through report ,we can get number of leads ina particular period for particular object.But i want to update no of leads in parent object.How?

Can anyone help me?

Kindly support and suggest.

Thanks.


pconpcon
I think your best option is going to be to do a trigger on the insert/update of a lead that re-generates the count for all of the Accounts that are stored in it's WhatIds.  This will only cause it to be updated when a lead is insert/updated and will not allow for a rolling time period.  If you want something that is an a rolling time period (for example last 30 days) you'll need to do scheduled apex that will query your tasks and generate your count for each account.

If you have an specific questions regarding either of the solutions, please let me know.