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
Katherine RoweKatherine Rowe 

Flow to delete opportunity team members

Flow newbie here, need some guidance. I figure I've got the basics working, now I need to design it for various situations.

Goal: When opportunity ownership is transfered and the "Keep Opportuntiy Teams" box is selected, then I want the flow to automatically delete the opportunity team member for the previous owner. Because we have Splits enabled, the owner is always added as an opporutnity team member. And as soon as the owner becomes the previous owner, I want the corresponding team member to be automatically deleted. For example, Joe owns the opp, Joe and Mary are team members. The opp is transfered to Bob, and the desired result should be that Bob and Mary are the only team members.

So far, I've got a single step in my flow that deletes the team member nicely. But it only works when "Keep Opportunity Teams" is selected. If I don't select "Keep Opportunity Teams", then the flow throws an error. Presumably because the team member has already been deleted and the flow doesn't know what to do? I'm not sure how to modify my flow to deal with this.

After I get that sorted out, then I need to make sure it can delete any splits it needs to. 

User-added image
Katherine RoweKatherine Rowe
I've tried changing my flow to this and it still gives me the same problem.

User-added image


User-added image
Katherine RoweKatherine Rowe
Ok I'm making progress. Seems like I had two problems above... I was using comparing against an empty string instead of null. And also, it didn't like my Send Email element for some reason.

So this is working for me now. It deletes the prev owner team member when "Keep Opportunity Teams" is checked and doesn't try to delete it when "Keep Opportunity Teams" is unchecked.

I'm suprised it lets me define an outcome without drawing a path for it. I only put the email element in there because I thought I had to give it something to do for that path.

User-added image
PappuPappu
Hi Katherinek,
You able to fix this issue?
If so, can u pls share the code here?
Neetam Kushwaha 9Neetam Kushwaha 9
Hi Katherine,

Were you able to fix the flow and get expected result.
If so could you please share.