You need to sign in to do that
Don't have an account?
Mayank.ms
Batchable class to update the lead status when no activity logged in within 30 days.
Hi All,
I need a Batchable class that will update the lead Status as 'Open' when no actvities logged under Lead Object
Step1: We have 2 lead status 'Contacted Attempt Made' and 'Discovery'. When these status set, I update the stage date (Custom field Stage_date__c).
Step2: If stage date is more than 30 days and no actvity logged under lead object from stage date then we need to update the Lead status as 'Open'
Can you please provide the class to update the stage
Thanks in advanced
.
Can you please below code,
Let us know if that works for you.
Best Regards,
BALAJI
All Answers
I will guide you, how you can achieve this:
- Create a scheduler on daily basis.
- Call a batch class from the Scheduler and set size of batch.
- Query all the records which are in your condition, i.e. no activity logged for 30 days.
- In the execute method, write the statement to change status of the records.
- update record.
- In finish method, if you need to catch the error write code for that.
Please find sample code for Scheduler and batch Job. Please check this link for scheduler: https://www.minddigital.com/how-to-call-batch-apex-by-scheduler-class-within-salesforce/Hope this helps.
Thanks,
Gaurav
Skype: gaurav62990
Can you please below code,
Let us know if that works for you.
Best Regards,
BALAJI
Here we are to guide you, not to provide you the exact solutions.
Thanks,
Gaurav
Thanks a lot :)