1B Flow Builder Tutorial - Get a Record and Use It

Sharing buttons:

okay for our next tutorial we're going

to query a Salesforce record and use

pieces of it for the email that we're

sending so here is our previous flow

what I'm going to do because I'm gonna

start to make changes to it I'm going to

duplicate it so that we can create a

lesson one B flow now to do I'm gonna

just click save as I get two choices

here you own you always when you're

saving can decide hey am I going to just

change the create a new version of the

current flow or use this to kind of

clone off a completely different flow

and if I wanted to make changes to

lesson one a then I would select new

version that allows me to start making

the changes but let's the old version

keep running which is good because there

may be flows that are in the middle of

operation and we don't want my changes

to break them so when you make changes

to an existing flow you give it a new

you kind of build up this set of

versions have different changes as you

go different versions of the flow but in

our case we're going to we're gonna

completely break free and do less than

one B get a record and use it and this

is also going to be an auto launched

flow okay so we're gonna expand on our

original flow by retrieving a record

from Salesforce and using that

information in the email we're going to

send and this is the record right here

Susan Farris I actually have set her

email address to the same place so we'll

be able to check and see the incoming

email coming in so we're gonna use get

records and give it a name

and the next thing we do is we say which

Salesforce object do we want so I can

type and it'll do a do a partial search

so I selected my object the next thing

is specifying which contacts to use you

can actually start with getting all

contact records but you rarely want to

do that usually what we want to do here

is be very specific so in this case

let's let's basically just go with first

name Susan and last name ferrus so that

will retrieve just this one contact for

our flow so I'm going to you can see

here I've got the different fields from

the contact are pre-populated and I can

set up my filter for my query and I'm

once again using standard just

hard-coded strings here rather than one

of the resources sort order I don't care

about that the next question how many

records to store isn't really important

to us because we know there's only going

to be one record so we're gonna leave

only the first record selected where to

store field values now the rest of this

configuration is about where to

temporarily Park the record so that it

can be used later in the flow and to

park data so you can use it downstream

as I like to refer to it you create a

variable variable is just another just a

fancy techie way of saying a place to

temporarily Park stuff so we're going to

create a

variable and we are going to basically

that's going to be a contact so we're

going to pull the contact data data down

from Salesforce and we're going to

temporarily store it in a contact record

variable so that we can pass pieces of

it to the email now to create this

temporary storage we're gonna have to

make resource and now let's go do that

so I click new resource and here are my

choices and what I want is right here

it's variable there's a lot of other

things here that we'll talk about in

later later tutorials and I give it a

name so I'm gonna call this cur contact

see you are short for current to help

help me realize that this is the current

contact that I have loaded in and then

here I need to specify what type it is

now I'm going to select record here in

previous versions this was called s

object but now were you referring to it

as a record so basically I need to

specify that because you can create

variables of different different kinds

you can create a simple temporary

storage for piece of text or a temporary

storage for a date but we want something

a little more complex than that we want

to contact so once again I'm going to

say I want a contact and I don't need to

worry about multiple values so I'm not

going to check this box availability

outside the flow this essentially allows

you to opt into letting data that you

retrieve be used outside of the flow in

our case we don't actually plan to use

this data directly outside of the flow

except for the email or sending so I'm

going to leave those alone ok and now

when I click on this again you can see

the Kerr contact the record variable

that I have just defined is now

available to be to be chosen

so you don't have you only have to go

through all of that the first time you

define a variable subsequently they'll

just be something you can pick from the

list and the final piece of of getting a

record for use in a flow is you need to

tell Salesforce which fields you want

the since the since the object and it's

the record could be very large

Salesforce doesn't want to automatically

get them all so in this case I'm going

to specify what I care about so in this

case I don't really you know I need the

FIR you know the first name in the last

name may become may become useful but

this is where I really have to think

about what I'm gonna wanted to do with

this record in my email well one thing

I'm gonna want to do is I'm gonna want

to use this email address so let's make

sure we grab that and then just for fun

I'm gonna grab a few other fields to use

in the body of the email so I'm gonna

grab vote for winter 20 icon and I'm

going to vote for on call availability

and this little icon shows you the type

of that field so these are simple text

fields and the final one I'm going to

grab is most expert product and so now

we are done preparing our record query

and we have it here and we can if we go

and look at these fields you can see

that the ones I grabbed are right down

here most expert product vote for winter

20 icon and on-call available so I'm

expecting to pull that data in and store

it temporarily for use later in the flow

now you see that although I've created

it it isn't hooked up so I'm gonna have

to hook that up myself okay so I'm gonna

delete that I can simply click on it and

and click my delete button and then

this inline alright so now I have

retrieved my record but I haven't done

anything to my sent an email and so if

we pop in there you can see that it's

still hard walk coated with this is the

subject line this is the body of the

email and a hard-coded address so let's

get rid of these hard-coded values now

what I want to replace this with I want

to replace it with the email address

from the contact where am I going to

find that well I'm going to find in that

temporary storage variable I created

called cur contact so if I go here you

can see that my list of Records is

getting larger because I'm defining more

things and here is the record variable

contact I click on this and it lets me

drill down and select the field now one

of these to be careful about is even

though it's got all the fields listed

here flow is only going to actually have

data to work with

if you specified it early in the record

query so just to show you that so let's

save that if I go back here once again

down here at the bottom I had to solve

it I have to specify which fields I

actually want to bring along for the

rest of the flow so I don't have for

example I didn't add birthday could have

added birthday could have gone here and

selected birthday but I didn't add it

and as a result here I'm even though I

can pick it from the list

it wouldn't work so that's something

we're gonna have to have to do better

within the future

ok so let's let's change the body the

subject line well let's change the

subject to here's the data we have on

you have on you

now what I want to do in the body is I

want to mix some text with these three

values that we that we pulled out from

the record most expert product vote for

winter 20 icon a non-call available this

is a classic mail merge I sort of need

to create a template with some text that

is hard-coded and then I want to merge

in the values for whatever contact that

I pull now I've set up this flow to

automatically pull Suzanne fares but we

want to design this so that I can change

that to another name and it will still

work so we need to every time we run

this we want to pull the proper values

for the different persons so for example

if we change that to Lauren Boyle we're

gonna want to grab her values which are

a little different

all right so the way that you create a

mail merge in flow is with a resource

called a text template so we're gonna go

over here to manager and I'm gonna click

on new resource so it's a very useful

tool here it shows it shows all the

resources you've created lets you edit

them and delete them and let you create

a new one so here I'm going to go down

here I'm gonna select text template and

let's call this the email body yeah this

is the text template used for merging

and contact data okay so so now I want

to sort of write the body my mail here's

what we know about you you voted in the

following way for the winter 20

Salesforce edition icon

and now to insert the merge I'm

basically going to go and pick it from

pick it in kind of exactly the same way

so I go to here to cur contact and I

select that value just like this now I

could have typed that in this is this is

this is plain old text and let's see you

you you are most expert in the following

Salesforce product and that's basically

that's called the field is called most

expert product you got to be careful

here because the fact that you can type

stuff means you can break stuff too and

then finally your current on call status

is and then let's get alright so now

we've got our text template there and

now that it's a resource we can use it

text templates or strings so we can go

here to this subject and you can see

that the text template that we define is

now available for choosing so I'm going

to simply insert that and once again you

could just go you could just go type it

in alright so I think we're done here

let's run our flow save it flows

finished well you can see we can see the

mistake I made the good news is the flow

did exactly what I told it to do the bad

news is that I I wonder how many of you

are watching us we're already like

noticing that and going man he's gonna

he is in for a surprise but that's

easily fixed easily enough fixed so

let's grab this you can see that I could

just paste that in here into the body

and you can say here's what we know

about you and save that save it again

you run finished right and let's go and

yeah that's a little more like it and so

you can see how you can pull data out of

Salesforce and use it for things in this

case we used it for sending an email