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
Karen Brown 39Karen Brown 39 

Flow to delete Open Tasks when opportunity is stage = Archived

Hi, we have a number of tasks that are automatically added to opportunities using Process Builder and Flow to pass different assigned too and due dates etc.  What I need to do is if an opportunity is marked as Stage = "Archived" i need a flow to check if there are any open tasks on the opportunity and then delete them,

We need to delete rather than close as these tasks are asociated to steps in the closing process and if the opportunity is archived the closing process stops so I dont want these tasks to show up for my users.

How do i use a flow to check and list all tasks that are open and then conduct a delete action?
 
Best Answer chosen by Karen Brown 39
Manj_SFDCManj_SFDC
you can refer these too
https://success.salesforce.com/answers?id=90630000000CzoqAAC
https://automationchampion.com/tag/fast-delete/

All Answers

Manj_SFDCManj_SFDC
Hi Karen, you can configure a process builder and pass the Opportunity Id to the flow as a flow variable when opportunity is stage = Archived and in the Flow you can run a fast look up to get all the associated tasks and assign to a list and delete them after the loop ends you can refer this
https://help.salesforce.com/articleView?id=vpm_records_delete.htm&type=5
 
Manj_SFDCManj_SFDC
you can refer these too
https://success.salesforce.com/answers?id=90630000000CzoqAAC
https://automationchampion.com/tag/fast-delete/
This was selected as the best answer
Karen Brown 39Karen Brown 39
@manj_SFDC Thank you i have successfully created this flow.
Krishna Chaitanya TataKrishna Chaitanya Tata
@Karen Brown,can you please post some screenshots related to lookup to the task and passing the opportunity id to the flow.