ExploitedDevOrgs

Changing the way Salesforce Admins and Developers think about client solutions.

Web to Anything Part 2 – Deleting the Lead using Process Builder and Flow

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

CreateVariable

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

Variable

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

DeleteContainer

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

Record Delete

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.

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.

  1. Create a new version of the Process (since you can’t adjust an active version)
  2. 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:

Process

 

For the Action itself

  1. You are calling a flow
  2. You are passing the Lead ID over to the flow as your Variable

PBcallFlow

Step 4

Don’t forget to Activate the new version of your Process

Don’t forget to test the new version of your Process

Additional Notes

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.

Share Button

3 Comments

  1. Great post, appreciate this info on Process Builder and how to delete a lead. Very helpful with a current project I am working!

  2. “Also known as the only part of the flow.” – This made me laugh.
    Thanks so much, Geoff! Been waiting for this since your last post.

    Best,
    Brooks

Leave a Reply

Your email address will not be published.

*

two × five =

© 2017 ExploitedDevOrgs

Theme by Anders NorenUp ↑