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
Matt PicherMatt Picher 

Flow to auto-close Opportunity based on last activity date

Hello, 

I am trying to write a flow to auto-close opportunities based on the last activity date so I can avoid mass updating lists of opps every couple of weeks. So far I have not been able to make this work. 

I created a custom field called "Days Since Last Activity" and would like any opp that is not "Closed Won" or "Closed Lost" to be automatically moved to "Closed Lost" once the Days Since Last Activity field hits 240 or higher. 

Any help or guidance would be appreciated!
Best Answer chosen by Matt Picher
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Matt,

In this scenerio you have to use scheduled trigger flow as below. Set the frequency as Daily at some time.

User-added image

set the object settings as below.

User-added imageAdd the update record element as shown below.

User-added image
Save the flow and activate it. The flow gets scheudled and you can see it in scheduled jobs. 

This flow runs every day at particular time and tries to update the stage.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
HI Matt,

Do you have 'Days Since Last Activity' field populated in you org?

Thanks,
 
Matt PicherMatt Picher
I do. I recently created that field and it calculates based off the Last Activity Date field. I’d like to get oops to automatically moved to Closed Lost as soon as that field hits 240 days with no activity. Get Outlook for iOS
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Matt,

Is that a formula field ?

Thanks,
 
Matt PicherMatt Picher
Yes it is. Get Outlook for iOS
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Matt,

In this scenerio you have to use scheduled trigger flow as below. Set the frequency as Daily at some time.

User-added image

set the object settings as below.

User-added imageAdd the update record element as shown below.

User-added image
Save the flow and activate it. The flow gets scheudled and you can see it in scheduled jobs. 

This flow runs every day at particular time and tries to update the stage.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
This was selected as the best answer
Matt PicherMatt Picher
This worked great, thanks for the assistance!