My last post explained how to leverage Process Builder and Web to Lead functionality to create a record for any object in Salesforce directly from a website.
At the end of that post I said I needed to still figure out how to delete the garbage lead that I just created, but that I’d be back to show people how, so here I am.
If you’ve never used Flow before it can be a little bit intimidating. I once again recommend Rakesh’s website if you really want to learn (as I’m doing now).
What I did know going in is that:
- I can call a flow from Process Builder
- I need to pass a variable across so that the flow knows what to do
Step 1 – Create the Variable
In the Flow Designer, click on the Resources tab, then double-click on Variable
Then you just need to name your variable, set as Text, and set the Type as Input and Output. The Default Value will be empty because we are going to pass this value through using Process Builder
Step 2 – Create the Record Delete logic
For this you go back to your Palette page and drag a Record Delete item onto the canvas
Deletes are great to configure just about anywhere in Salesforce because they are so easy – Salesforce just needs the Id, nothing else. Here I’m saying that the ID of the record to be deleted is equal to the variable that we configured above and will be passing in using Process Builder
Last item here is to set the Record Delete as the starting point of the flow. Also known as the only part of the flow.
At this point your flow is done. Just save and don’t forget to activate it
Step 3 – Adding the Flow to Process Builder
This part is easy because you’ve already got the hang of Process Builder from my last post.
- Create a new version of the Process (since you can’t adjust an active version)
- Add a new Immediate Action to each branch of the Process to get rid of the Lead that the W2L form created. Remember that branches evaluate based on True and False, so you’ll need a copy of the Action for each branch like this:
For the Action itself
- You are calling a flow
- You are passing the Lead ID over to the flow as your Variable
Don’t forget to Activate the new version of your Process
Don’t forget to test the new version of your Process
I was actually amazed once I got started just how easy this was to configure. I’d created a few Process Builder + Flow items in the past just working through examples I’d found on different sites, but I’m by no means an expert.
I have purposely tried to keep my explanations of Process Builder and now Flow to a minimum because there are lots of other people out there who do a great job already. I wouldn’t be doing it justice to start explaining the basics to everyone.
What I’m trying to do is show you different ways to think about things, and different ways to leverage tools that already exist. Who knows, by working through some of these you may find yourself all of a sudden being able to say to the business that you can do something nobody thought was possible, all because you’ve worked a little bit outside the box.