Best answer

Salesforce - Updating Multiple Fields if they are Blank

  • 8 November 2022
  • 6 replies
  • 160 views

Userlevel 1

Hello all, 

First post here, and fairly new to Zapier - Hope I will do this right. 

Scenario: When a Lead in Salesforce is updated, I want to check if one or many fields are blank. If so, I want to enrich them with Clearbit. I’m trying to enrich, if empty, the following fields: First Name, Last Name, Company, Phone

For each Lead, the fields that are blank might be different. For example, Lead A might have First & Last Name, but no Company, Lead B might be missing First Name, etc. 

I can’t use Paths, because there are so many scenarios I would need to cover, and Path is limited to 5. 

Essentially, I would need some sort of Actions that “would populate the SF Field with Clearbit Data only if the field is Blank”. I can’t seem to find a way to do this. 

First Name = Bob (don’t update)

Last Name = Roger (don’t update)

Company Name = Blank (enrich with Clearbit)

etc.

 

Hope that makes sense. Thank you in advance.

Guillaume

icon

Best answer by nicksimard 10 November 2022, 20:17

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @Guillaume Racine 

Good question.

Your use case would best be handled with a custom Code step: https://zapier.com/apps/code/help

Consider hiring a Zapier Expert if you need help: https://zapier.com/experts

 

Userlevel 7
Badge +11

Hey @Guillaume Racine!

Welcome to Zapier, and the Community :)

I’d written a response about all the ideas I had, and why they wouldn’t work. Then realized there was a different way to tackle it.

While it’s not super task-efficient, here’s how you could do it without code:

Trigger: Salesforce — Updated Lead
Filter: Only continue if “Enriched?” is false (I’ll explain below...there’s actually more to it than this)
Action: ClearBit — Find Person (or whatever it’s called)
Action (First Name): Formatter — Text — Default Value (screenshot below)
Action (Last Name): Formatter — Text — Default Value 
Action (Company): Formatter — Text — Default Value 
Action (Phone): Formatter — Text — Default Value 
Action: Salesforce — Update Lead (check the “Enriched?” box)

The Filter is required so that you don’t end up in a Zap loop, where the final Update Lead step ends up re-triggering the Zap. So you need some sort of field you can fill out to prevent that from happening. 

This is how the Default Value step works (you create one per field):

 

Then on the Update step you map all of the outputs from your Default Value steps, which will either contain the data that was already there, or the data you found from Clearbit. There may be instances where 

 

Important Info About the Filter

After thinking it through, the Filter will actually need something that checks to see if any of the fields are empty. This is what I came up with:

 

What it does: Is your “Enriched?” field false AND field 1 is empty OR is your “Enriched?” field false AND field 2 is empty, etc.

Hopefully this makes sense! Definitely test it out, since I haven’t put it through its paces. 

Userlevel 7
Badge +12

Hi @Guillaume Racine!

Were you able to take a look at @nicksimard’s suggestion? If so did it work or do you need some more help with this? Thanks!

Userlevel 1

Hello all!

First, apologies for the late reply and thank you so much for the replies!

I finally got to test @nicksimard’s solution and it works for my use-case so that’s very helpful, thank you. I would have 2 follow-up questions if that’s okay. They are somewhat related to this topic:

  1. I have a use-case where I need to Split the Full Name into 2 fields using the Split element. Is there a way to always have 2 outputs, even if the user input only their First Name? Ex: In an app, there’s 1 field for name. Instead of writing “Guillaume Racine”, I only write “Guillaume”. Reason for this is that sometimes, instead of checking if “App Last Name” field is empty”, I need to check if “Split Element Output2 is empty”. Right now, if only 1 name is provided, only 1 output is provided by the Split Text. 

 

  1. With Default Value (thanks again Nick!), I can only populate the field if it’s blank. Is there a way to update a field that has a specific value as well? Ex: For Salesforce, Company is required to create the Lead, so in certain scenario I populate this value with “Company Placeholder”. I want to Update this field with Clearbit if it contains “Placeholder”. Possible?

 

Again, thank you for the help. It’s REALLY appreciated. I got to optimize 3 Zaps already with this. 

Userlevel 7
Badge +12

Question 1

It’s not possible to do this with something like Formatter but there is a way!

If you use Paths by Zapier you can create a conditional logic where if the updated lead has a first and second name, the Zap follows one set of actions (eg the ones you have set up now) and if, after the split text field there is no second field, the Zap will follow a second set of actions. You could then add a placeholder last name in that set of actions, by typing in ‘Last name’ or whatever you want, in the relevant field. If you haven’t used Paths before, the Paths page explains how they work. 

 

Question 2

Do you want to only update the field in Clearbit if the company name is ‘placeholder’, or do you want to use the regular company name in Clearbit if there is one and add a different if there isn’t one? If it’s the second, you can do this with the Lookup table in Formatter. 

With the lookup table set up like this, it will look at the company name and if the company name is “Company Placeholder” it will replace that with whatever you type in the box on the right. If the company name is the placeholder, then the Zap will output the original company name. 

A caveat with this is that you can’t leave the lookup table blank, there has to be something to replace the company placeholder text. 

 

If you wanted it so that if there is a company in Salesforce, then the Zap updates that in Clearbit but if there isn’t a company, then the Zap doesn’t add anything to Clearbit, you can do that using Paths again. With Paths you can set up the condition that if the Company name is ‘Company placeholder’, then do the next X steps and if it contains anything else, do the next Y steps. If you do go down that route, you’re heading in the territory of ‘nested’ logic. Nesting paths in each other is a really powerful tool to set up Zaps the way that you need, but in my experience they need a bit of planning, so you may find it helpful to draw out the logic (eg like a flowchart) before you start. 

 

I hope that helps, let us know if you have any questions!

Userlevel 1

Hey all, 

 

Marked Nick’s answer as best since it answered my initial question. 

 

@Danvers your answer seemed to have solved my issues as well. Thank you so much!