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
sfdc_dev123sfdc_dev123 

count of Task creation in Lead

Hi,

 

My requirement is in my lead record related list when i want to create or update lead status with closed

that count updated in that record has one number custom field. Even record is deleted or undelete

from recycle bit it will update. Is it possible using trigger.

 

 

Please any one help me.

 

 

Thank you.

 

 

 

 

 

 

 

 

 

 

 

SammyComesHereSammyComesHere

Please elaborate

sfdc_dev123sfdc_dev123

Hi sammy,

 

A task is create with status COMPLETED related to lead object in my lead object has one custom

fiels Count_of_Task__c(number field) count 1 add to that record. Suppose Atask is created status with

not with COMPLETED(remaining any one)  it willn't add count. But when update the status of the task

should be complted it can add count.1 we can change status it can decrease the count 1 suppose

task is deleted count will decrease even in recycle bin we can undelete the task count will add 1 if status 

COMPLETED in both cases.

 

 

 

Thank you for your reply.

 

 

 

 

crop1645crop1645

Yes, you can do this with an after trigger on Task.  You need to handle after update, after delete, after insert, and after undelete.  Normal trigger idioms should be used so as to support bulk DML updating of all parent Leads in the event that more than one Task is updated to Completed in a batch operation.