Question

How do I create an email address based on a text field in Salesforce?

  • 29 November 2023
  • 11 replies
  • 79 views

Userlevel 1
Badge

In Salesforce, we have a text field indicating the customer’s implementation manager. I’m creating a Zap that sends an email to the Implementation manager listed on the account when a specific trigger happens. In the Zap flow, how can I find the name in that Salesforce text field and convert it to the IM’s email address? 

 

here is my flow:

 

Trigger: Salesforce opportuntiy stage changes (“Updated Field on Record”)

Step 1: “Find Record” > where the Record is the Opportunity which contains the text field of the IM’s name

Step 2: Send Email

 

Somewhere in here I’m sure I need to add a step that converts the text to an email, no? 


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

11 replies

Userlevel 7
Badge +14

Hi @cfalcone01 

Good question.

Where is the IM email address saved? (e.g. on a Salesforce record or in a Lookup Table)

Userlevel 1
Badge

@Troy Tessalone Their email is not saved in Salesforce and I do not have a Lookup Table. should I create one? Can you share a how-to article or steps on how to do that and set it up within the Zap?

 

Userlevel 7
Badge +14

@cfalcone01 

 

Userlevel 1
Badge

thanks @Troy Tessalone Is there an article that explains the different between when/why you’d want to use:

  • Find or Create Record vs. Find Record(s) (Output as Line Items)?
Userlevel 6
Badge +8

The former would be if you want only one row returned. The latter would be for if you are expecting more than one as a possibility.

The other difference with the former is that if it doesn’t find the record it can optionally create one, but I don’t think the latter gives you that option

Userlevel 7
Badge +14

@cfalcone01 

Depends on which Zap app you are trying to use for the lookup table.

Userlevel 1
Badge

@Troy Tessalone @shalgrim still running into trouble with trying to use the Lookup Table - any recommendations based on what I’ve done so far? 

As a recap, here is my goal: I’m trying to send an email after a Salesforce Opportunity updates to a certain stage. The email should include the Product Manager(s) responsible for each product sold as part of the opportunity, with their emails being pulled from a 'Zapier Table'. The Product Manager depends on both the product and the region.

 

I know I can map the email address from the output of the "Find record in Zapier Tables" step to the "To" field of the Send email action in all the paths. In the live run, this email address will vary depending on the outcome of the find step, and the path to run will depend on the filter condition you have set. However, I am only able to retrieve one PM email when there are multiple products listed and I need to include multiple PMs….

Here is where I am getting stuck. If there is more than 1 product listed on the opportunity, I need to include the Product Manager for each product on the email. I'm getting stuck trying to pull the emails for all potential product managers. Here is an actual example with our products:

 

1. Here is an overview of my current Zap setup

 

Step 6 is where I create a loop to extract and create a line for each product listed on the Opportunity. In the particular example I am working on, the following 4 products are being sold as part of this opportunity:

- TW

- ARMS

- RA

- WR

 

Here is a screenshot of Step 6 Action and Test Results:

 

Now that I have each Product Code being sold on this opportunity, I use Step 7 to look up the Region of the customer and then the PM for each product from my Table. I get an error when I try to search across all 4 products (see my Action set up below):

 

When I set up Step 7 like this (see below), my test is successful but only returns the PM for 1 product (see test results below):

 

 

My table in Zapier looks like this:

 

Userlevel 7
Badge +14

@cfalcone01 

If you are trying to lookup all the matching record in order to send 1 email, then you may have to do some sort of Digest or Storage concept, where you loop thru each product to get the PM, then append that to a designated variable then only continue after the last loop. (Looping help explains how to do this with a Filter)

You’ll want to put a Delay in between each loop iteration.

Userlevel 7
Badge +14

@cfalcone01 

A more advanced approach would be to use 1 Code step with a FOR loop and some app API to do all the lookups and concatenate.

Userlevel 6
Badge +8

Wow, thanks for all the detail!

When I set up Step 7 like this (see below), my test is successful but only returns the PM for 1 product (see test results below)

That second way of setting up Step 7, where you’re using “Product Code”, is definitely the correct way to set it up.

As far as it returning only one product, what about when you run it as a live Zap instead of testing the step in the editor? I just set up a very similar Zap and when I tested in the editor it only gave me one record like you show, but then I ran it as a live Zap and got all the data I was expecting. I think you are be running into an artifact of testing loops in the editor

I’d also be curious what happens if you went with “Find or Create Record” instead of “Find Records (Output as Line Items)”. For each item in the loop you’d only be expecting a single record, right? I set mine up as “Find or Create Record” and it worked

 

Userlevel 1
Badge

@shalgrim I’ll try that and report back. Thank you both!