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
Nicole Chang_Nicole Chang_ 

Lead update status based on activity

hello everyone, 
Is it possible to have lead status updated automatically depending on activity outcome? 
For example:
1. Lead status is "New" -> task "call n" created automatically
2. task outcome "no anwser" --> lead status update to "working", task "call n+1" created, so on & so forth...
 
SubratSubrat (Salesforce Developers) 
Hello Nicole ,

Requesting you to go through this reference article which will help you with your requirement -> https://help.salesforce.com/s/articleView?id=000389961&type=1 (https://help.salesforce.com/s/articleView?id=000389961&type=1)

Hope it helps !
Thank you.
Nicole Chang_Nicole Chang_
tks Subrat, already went across it, but this also includes creating process builder? 
Aegis SoftworksAegis Softworks
You can do this with a flow.

Go to Setup > Flows > New Flow > Record-Triggered Flow.

Object = Lead, Trigger when record created, condition Status = "Open - Not Contacted", Optimize for Actions and Related Records.

On the Activity object, create a custom field called "Auto Call Task Counter", data type number (Length 3, 0 decimals), not on any page layouts, default value of 1.

Back in the Flow, click the Plus button on the flow path to add an element, and go to Action > New Task. Label = "Create First Task".

Assign To Id sets to the lead owner: {!$Record.OwnerId}
Due Date: New Resource > Formula > API Name = "TheDueDate" > Data Type="Date" > Formula= TODAY() + 7
Name ID (whoid): {!$Record.Id}
Subject: New Resource > Formula > API Name = "TheSubject" > Data Type = "Text" > Formula = "Call 1" (or work this formula to be more detailed, like including name and company name)

Back in the Flow, click the Plus button on the flow path to add an element, and go to Update Records. Set the name to "Update Lead Status", and set the Lead Status to "Working - Contacted".

Save the flow as "Lead - Create First Call Reminder Task". Then click Activate.



This will help you get started, by creating the first task.

For the follow-up tasks, you will need to make a separate flow called "Task - Create Follow Up Reminder Tasks" using similar to what is above. Have the flow fire on task update, if the Task Status = Complete, the Task Outcome = "No Answer", Subject starts with "Call", and the parent object is a Lead with a status of "Working - Contacted", etc.

You'll need to then query all Tasks where parent is is that lead, Subject starts with Call, ordered by "Auto Call Task Counter" descending. Get the Auto Call Task Counter value and increment it by one, and save it to a variable.

Then create your new task, with the subject using the new incremented number. etc.


If this is your first flow, I think you will be able to figure it out in an afternoon. Just takes a lot of trial and error and testing.
Nicole Chang_Nicole Chang_
tks so much! I created two flows, one on lead object and the other on task object 
1. On Lead object: record-triggered flow to create task based on lead status
User-added image
2. on Task object: record-triggered to update Lead status based on Task status (task outcome)
User-added image
User-added image
User-added imageUser-added image
Flows failed (ikr), am I missing anything here please?! (Both task & lead statuses are picklist values) Much appreciated any help!!