+ Start a Discussion
Kondal Rao learnerKondal Rao learner 

Hi Regarding lead duration

HI Experts,


Actually my requirment is that when lead is created with the startdate and endate right so i will assign this lead to some other one so when owner changes of lead so i want to find the days , between this time slot i mean between first owner of lead to second owner of the lead so please guide me how to do that.




Thans in advance







Hi Adithya,


You can achieve this using a trigger here i'm posting a sample code which will help you



trigger ownerchange on Lead (before update) {

      for(Lead Le:trigger.new){
          Lead oldLead=Trigger.oldmap.get(Le.id);
             DateTime Dt=System.now();
             integer numberofDaysDue =  Le.DOB__c.daysBetween(Le.doj__c);   ////////// You can replace these fields with which you want to know the difference say( Le.Stastdate__c.daysBetween(Dt))
             System.Debug('@@@@'+numberOfDaysDue );




Please accept it as solution if it sloves your requirement