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
snyhansnyhan 

Lead Management Trigger or Workflow Rule

I have been tasked with creating a lead management system that will update the lead status at certain Last Activity Date intervals. While the workflow rule I created did allow me to update the lead status upon Last Activity Date changes, I am unable to manually change the lead status. Also, is there any way to get the rule or trigger to fire without manually updating each lead in our database? We would like this to run in the background to create less work for our sales reps and marketing team.

 

Ultimately, I need a workflow rule or trigger that will do the following:

 

If Last Activity Date is within the last 120 days, the status should be Active unless the salesperson has manually changed the status. The Last Activity Date should not include mass emails.

If Last Activity Date took place between 120 and 180 days, the status should be Paused unless the salesperson has manually changed the status. The Last Activity Date should not include mass emails.

If Last Activity Date is over 180 days ago, the status should be lapsed unless the salesperson has manually changed the status. The Last Activity Date should not include mass emails.

 

I've included my workflow rules below. Unfortunately they worked like a sledgehammer and I was unable to manually update the lead status. Also, I could not figure out how to exclude mass emails from the last activity date.

 

Workflow Rule 1: ActiveLeadStatusUpdate

Evaluate when a record is created, or when a record is edited and did not previously meet the rule criteria.

Rule Criteria: AND((( TODAY() - LastActivityDate ) <= 120), OR( ISPICKVAL( Status , "Not right now"), ISPICKVAL(Status, "Not in market")))

Field Update: Field to Update = Lead Status, New Field Value = Active

 

Workflow Rule 2: Reminder/PausedLeadStatusUpdate

Evaluate when a record is created, or when a record is edited and did not previously meet the rule criteria.

Rule Criteria: AND(OR(( TODAY() - LastActivityDate ) > 120,(TODAY()-LastActivityDate) < 180),OR( ISPICKVAL( Status , "Not right now"), ISPICKVAL(Status, "Not in market")))

Field Update: Field to Update = Lead Status, New Field Value = Reminder/Paused

 

Workflow Rule 3: LapsedLeadStatusUpdate

Evaluate when a record is created, or when a record is edited and did not previously meet the rule criteria.

Rule Criteria: AND((( TODAY() - LastActivityDate ) => 180), OR( ISPICKVAL( Status , "Not right now"), ISPICKVAL(Status, "Not in market")))

Field Update: Field to Update = Lead Status, New Field Value = Lapsed

 

As you can probably tell, I'm pretty new to workflow rules, apex triggers, and developing as a whole. Any guidance will be greatly appreciated.

 

Thank you!

 

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Please see this , I hope this comparision helps you in deciding your case.

 

http://forceschool.blogspot.com/2011/05/hi-all-triggers-are-very-essential-in.html

All Answers

Shashikant SharmaShashikant Sharma

Please see this , I hope this comparision helps you in deciding your case.

 

http://forceschool.blogspot.com/2011/05/hi-all-triggers-are-very-essential-in.html

This was selected as the best answer
nyhansanyhansa

For some reason I was forced to change my nickname, still the same person as snyhan...

 

Thank you so much for sharing the link to your blog! It was extremely helpful in making a decision. Your additional posts on Apex Triggers were also very helpful.

Shashikant SharmaShashikant Sharma

Your welcome snyhan,

If you consider post on my blog helpful for making a decision to you , please mark this as solution, it will help other as well if you do so.

nyhansanyhansa

I'm not sure if it has anything to do with having to change my username/nickname, but I don't seem to have the option to mark your reply as the solution. I have tagged it as a solution, but that seems to be all I can do. I will continue to try to mark your response as the solution.