Using Filter Steps When Creating a Formula
Hey guys, welcome back to the Formula Builder videos here. I want to show how to tweak our Formula that we made in the first video just a little bit. Let’s say I only want to listen for “contact updated” events. So I don't want the Formula to run for any events that are received from my CRM Element, I want it to run for only certain events. So let me show you how to add a filter step to filter out any data that we are not interested in.
1) So let's do that now. I'm logged into our console. We still have my crm to email Formula we built in the first video so let's click edit on this.
2) Let's click on the steps screen.
3) So here are the current steps we have, we listen for events, we construct our email body from those events, and then we send that email. But let's say we are only interested, like I mentioned, in “updated contact” events. So what I'm going to do is I'm going to create a new step, let's choose the filter step.
5) If the event isn't for an updated contact, then we don't want to do anything else. So I'm going to change the “on success” here to be “filter-events”, and then I'm going to change the “filter-events” to got to “construct-email-body”. Perfect, and now you can see we've inserted that filter here. So these two steps will only run if it was for a “contact updated” event.
6) So now I'm going to hop over to our Salesforce account and I'm going to actually update a contact to make sure we do get that event. So I'm going to add a phone number to this contact here, and click save here which should send an event to the Cloud Elements platform which should click off our Formula, and that should actually still send me an email because that was a contact updated.
7) So let's go ahead and check my email. Perfect, you'll see that I did get get a “contact with ID ..” was updated, so that happened properly.
8) Now, let's actually create a new account in Salesforce, and let's make sure that I do not get an email there. So add another account “JoshTestAccount”, and click save here. So that saved, and now let's go over to my email and make sure I did not get an email.
9) Perfect, so you'll see in my email here that I have not gotten an email for the new account because we are filtering those events now with that filter step.
10) One other thing I want to show is actually how you can see these executions in our console. So let's go back to the console and on the left side you'll see this “executions” panel.
11) So if I click executions, click “my Formula instance”, here are all the times the Formula has executed so far. So let's click on the last execution, and you can see “filter-events” actually failed because that was not a “contact updated” event.
12) The one right before that we did about 30 second before that, if I click that you can see that all four steps ran successfully because the “filter-events” detected that it was a “contact-updated” event, and therefore they all ran.
13) So here's another helpful screen that can help you debug, you can actually click on these and see the step execution values, and you can kind of use this to debug your Formula executions.
So that's how to add a filter step. Thanks guys!
About the Author
Vivek is a Marketing Intern at Cloud Elements.More Content by Vivek Ravishankar