How to: Build a Complex Flow - User Requests! (Salesforce Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's video we're going to be looking at a flow specific flow use case and this has come from somebody who has posted in the channel specifically as i guess it's just their initials i'm guessing possibly and well thank you very much for the comment as and here's the use case the use case is a company b2c who wants to reward their customers every three purchases so the goal using flows would be to send an email alert with a coupon and create a voucher object for that person account with the coupon for those who have 3 6 9 12 15 etc opportunities great so essentially we're going to create a more complex flow using a little bit of mathematical logic we're going to look through records we're going to identify if a new record has been created or edited to meet the requirements of this use case and then subsequently if it does match those requirements we're going to create a new record in a new object and send an email out to the customer to reward them with a coupon right so we're in setup and what we want to do first is going back to this use case what needs to happen is to create a voucher record every time the customer makes three purchases those purchases being three opportunities i'm going to make some really big assumptions in this because the use case isn't that detailed so i'm going to say that the opportunity would have to be closed one that would constitute a purchase okay and that would be the trigger point for which the flow would then run and assess this customer hit three purchases yet if so send an email or first create the record the voucher record so that we've got a voucher id that we can then put into the email and send the email out to the customer and go well done thank you for the three purchases here's a voucher code for your next one but before we go into the flow we need to have that voucher object ready let's go and create this voucher object now you can see i've already uh created this voucher object but if you did want to do this from scratch you go to new uh object and put the details in there but because we've already created this let's just look at the va the voucher objects that i've created because it's quite important that we get this bit right if i click edit on there you'll see the screen as if you would see it in classic mode if you were to create a new object so we put a label in we put the label it for the plural with the with an s at the end object name and here's the important bit so record name i'm gonna keep it the same voucher voucher name fine but instead of this hat being a text for the account name i want it to be a an auto number now this is the number that i will you you can create a custom field as an author number after but the reason why i want to do it here because if i put text then i'd have to put something in as the voucher name what am i going to call it voucher one voucher two it then just becomes rubbish data effectively so let's be really efficient with this record data and therefore let's just create this voucher code that i'm assuming we need to make for this use case now i've done autonumber and i've done this as the format the display format for the voucher code or the voucher auto number of the record um this here is essentially just text so i could put um daffy duck and if i save that and every record i create it will say daffy duck and then as you can see here i've got a date format that i can put in there so with salesforce there are a few things that you can do and you can see that by looking at an example there if also click there you'll be able to see the help section which just tells you the types of formats that you you're able to do within this it's a bit limited but what i want to do is i'm going to assume that we want to use or log the year the month and we can have an auto number so hyphen again is just the text you know i could put an asterisk there or i could put you know hello or vouchy um oh whatever it is i want to do but i'm i won't be silly i'll just put hyphen and then just a couple of zeros now what these zeros do and you can see here there's four zeros is it will add a number zero one zero zero two zero three zero four zero five zero six and it will keep doing that and it basically just puts little zeros above the before the numbers it's like a prefix for it and let me just change it from daffy duck back to my v and i'm using the hashtag which is kind of like a way of saying number so i've got voucher number and then i could maybe put a hyphen there other bits um allow reports allow activities yeah fine we'll allow reports on that so we can report on vouchers and we'll put it to deployed and we'll allow search as well so that basically means that you can search it in the global search i won't save it because i've already saved this one but you of course would would save it and that's it really so now we've done step one we've created our voucher object great now next thing is the flow so if we go back home and type flows flows can click into my flows and i can go straight to create new flow now big first step which type of flow we're going to be creating is it screen flows schedule triggered flow yada yada went in the other video about the different types uh briefly of the different types of flows but what we want to do thinking back to the use case um we want to be creating a record triggered flow and that's because we don't want to do anything in the system we don't want to send an email to the customer or create a voucher until they have sold or bought three things or made three purchases and again that means three opportunities that i'm assuming would be set to closed one so therefore and this is really important to help make your system very efficient is we don't want to be setting every single time we want to make sure that we um only run this flow when conditions have been met that are as specific as we can be and the specific the specific specific specificity specificity that word is um when the opportunity has been created or edited and set to closed one okay now we also have another condition which is oh yeah i want it to be every three opportunities but we'll look at that in a second in any case record triggered flow is what we want let's click next let's do the free flow one i can move it around how i like okay now we're starting here and let's just click edit on there just to check that we've got this correctly so the default is a record is created but i've already said i want this to only trig to trigger not just when a record or an opportunity has been created but also has been updated now that's the key thing this is why i always recommend to like kind of write things down and draw it all out so you know in your head how things flow through as you start creating it you kind of prepared before you go into flow so we know opportunity is the trigger point so it's a record is created or updated and we you've got the option to run the flow before the record is saved or after i'm going to say after it's saved and that's because just in case and this might be if you've got a more complex org but there might be some other maybe some apex code or maybe some other things that are happening on the record that will change the status of that opportunity that we're looking at for example closed one and that's what we're really that's what we really care about so we want to kind of just assess this after the opportunity has been saved done now you can see here choose object so let's choose object object and we know it's opportunity we can start typing it and then i have said we want to be very specific with the conditions because if i didn't put a condition there it would just run this flow every time an opportunity is created or updated which isn't ideal because we're then going to start slowing down the system in a way really that it's just always going to be firing this flow it's not going to be very efficient so what did we say we said we wanted this to only run the flow when the stage equals if i click this we've got all of the values here so if you're not very familiar with flow you can see things look different but it's still essentially a lot of familiar ways in which you can add things like these uh queries and these logic statements similar to reports similar to formula field and things like that um they just look a bit different so here are the values from the pick list but i've also got other things like global constants like true false or or whatever or no not null um but we want closed one okay and do we want to find this every time a record is updated and meets the conditions or only when a record is updated to meet the condition requirements and what we want to do is only when a record is updated to meet the condition requirements um because again that's been very specific about what we want to do and it makes it more efficient as well let's click done right okay what do we do need to do now what do we need to do now going back to the use case we want to do something we want to send the email create the voucher record when three opportunities have been set to closed one so how do we assess how do we know that how do we determine that well the thing that will trigger it is being in an opportunity and updating it or setting it to closed one so now i'm in that opportunity i need to know is this opportunity the third one in the sequence against the account so what i need to do is i need to get records i need to get all of the opportunities from the account that the user is updating this opportunity from within okay stay with me let's go to a well let's go to the get records icon drag that in as soon as we do that we can then put a um label and name for this so what we're going to do is we're going to go up opportunity list i try and make it as descriptive as possible so it's very obvious when we reference these later what what these things are so this is our list of opportunities and of course we want this to be from the opportunity record opportunity object now if i don't put any conditions in as you may guess it's just going to pull through all opportunities from well it's just going to pull through all opportunities and i've said that i want the stage to be closed one so let's do that okay so find all opportunities that close to one great but only the opportunities so filter this list down to only the opportunities against the account that the user is currently in the context of meaning they've updated an opportunity that opportunity is always connected to an account so what account is that opportunity connected to that they are firing this uh flow from so if i go into this again these are all of the fields that are on the opportunity object that i've selected there you see so if i go there to the opportunity object and go to account id that's how i can zero in i could then go equals now what's the account id now the account id is some gobbledygook number with letters and numbers and it changes all the time depending on what org you're in or what record you're in that you're firing it from etc etc so we need to be dynamic here if we click in what we'll see is we've got a number of options and we've got global constants so things that never change true false not null and then we've got some global variables so we've not created a variable yet but we're able to access some global variables that are always accessible to us and these variables are dynamic and if we go down to dollar sign record you'll see that it's it's showing you this is in relation to the opportunity now what this means is the dollar sign means in the moment of in the context of in the instance of the user doing something and the record that they're in so if they've just hit closed one and save on a record that is the dollar sign record that i'm referencing um in this already and you can see their dollar sign record dot and what that means is i'm going into the record that the user at that particular moment time in the future is clicking on and you can then select the account id there we are done so now my list will only be opportunities that are closed one and where the account id equals the account id on the record that i've clicked on great if we scroll down we don't need to sort in order we're not displaying the data or anything it doesn't matter what order it's in how many records to store i want all of the records that this get records function finds and how do we store it we want to just store all of the fields from the record fine let's click done and let's draw our line so that's our first thing now it says run immediately that doesn't mean the flow will run immediately all the time it will only run after this criteria that we've set up but as you can see i can add a scheduled path optional which means i could basically put a time timer on or or i'll set it against the date or time field but we're not that's not in our use case that i can detect um so first we've now done this we've we're going to get all of the opportunity records next we want to then capture and well first we want to count how many of those opportunity records meet the criteria on that account and once i know that number which hopefully will be three well eventually will be three that will then trigger oh send an email and a voucher i i want to store that number somewhere that count of of opportunities because this is just pulling the records and holding them in a table it's not doing anything with it it's waiting for me for the next step so what is that next step what we can do so in the old days of flow for those of you that would know um you normally would have to do a loop function where you're essentially going okay show me a list of the table of records then loop through the records and do something you know count them all which is what we want to do is one of the examples but since i think it was 2018 or 19 something like that one of the releases meant that in flow there is a specific function where you can assign a variable value uh using uh an equals count function sounds confusing let's let's let's make it simple now this is the assignment function and what i can do is i can go um count of or um capture up count okay that's as descriptive as i can think of and then it says set variable values so what is it you want to assign a value to well i could search my variables there and but i haven't actually got a variable set up yet because what i want to do is put that count of opportunities and put it into a resource a variable that i can reference later on because we're going to do some maths okay um now you can go to the manager um tab up here and create a new resource or quite helpful you can create the new results from within here which we'll do what's the resource type well we've already said we want a variable and we'll we'll call this up count pretty straightforward short for opportunity count data type uh we want this as a number because we're just going to do that and we want it as a whole number it's not going to be a we don't want to display or consider it as a decimal and i'll tell you why in a bit uh default value no default value and let's just click uh done okay great now we've created our op account variable that we'll reference later on you'll see in the manager tab as i mentioned now this is where it gets interesting this new assignment function like i said has the ability to do equals count so when i click that it will then say right well what what am i counting up i can count something and then put that as the value in your op count variable so let's look at the options well we've got the global variables yadda yadda but this is the one that we want it's the it's called here a record collection variable but essentially what it is it's if we jumble the words around a collection of records as a variable that we can reference and this you'll notice this is why naming things in a descriptive way helps you it's called opportunity list and i know that's my get record function so the get records function is putting it into its own collection of records a variable table and i can now click on that and what that's essentially doing is in this get records opportunity list table count all of the records and put the resulting number in the op count variable that i've just created coolio done let's drag a line across there so now i get my opportunity records that are specific to closed one and the account that the user is clicking the opportunity in and then assign the count of those records to a variable what next next we now need to do something clever now when thinking about this i had to think about this before obviously i'm just doing it on the fly um how do you know so the requirement was if we go back to it um it's not just when it hits three opportunities or three purchases they want the email and the voucher to be created and and the voucher code to be emailed out every three purchases so how how do we do that where's the how do we build the logic to do that now you're probably much cleverer than me much more of a mathematical mind where you could probably think of the best way to do it which probably is more sophisticated in that what than what i'm going to come up with but essentially what i want to do is to divide the number of opportunities in total by 3 because 3 is our interesting number and by doing that what it does is it gives me a number that i can cross-reference and assess against the number of vouchers keeping you here so if i have got two opportunities and divide that by three and i'm dividing it by three each time in the assessment the resulting number is going to be something like you know a decimal number recurring but it's going to be less than one okay because i don't have three two divided by three is going to be like naught point whatever it is but once i hit three opportunities at closed one three divided by three is one great so now i've got the number one and what i'm going to be doing is i'm going to be counting the vouchers against the opportunity and using that voucher count to say well how many vouchers have i got because if i've got zero but i've got the number one as in three opportunities divided by three gives me one well then it means that i'm i need one voucher i'm one down so that is the logic that i'm using to then create the voucher and send the email out because i know that they've hit the qualification of three opportunities but they don't have a voucher yet so go do it and this is very important because if we follow this through if um there is already a voucher let's say you know they they close a fourth opportunity so four divided by three is one point something okay so if we like i said we don't want to deal with decimals we want to work with whole numbers so what i want to do is round that number down to the nearest whole number so that we're we're just again want to reference this against the number of opportunities so if they close four divide that by three is one point something round it down to one so now i know that my factor is one i then look and see how many vouchers there are if i'm counting them and let's say i've already ran this and we've already sent them a voucher i can see that my voucher count is also one okay so don't don't send them another voucher because they don't qualify yet i only want them to get another voucher when they hit another three opportunities so opportunity number five divide that by three still one point something if i then go to six opportunities that are closed one divide six by three is two so two means if i reference that against my counter vouchers in this example of only one voucher has been sent out so far i can then use the flow logic to say oh i've got a number two here but only one voucher so i need to trigger the creation of a voucher and send the email out and then i've now got two so if it does run again and assess in the flow it's not going to send another voucher out because it knows i've got enough vouchers for the for the factor that i'm working on hopefully that crazy logic in my head has been described or passed over quite used or you can understand what i'm trying to get at we'll go through this bit by bit so that it becomes very clear right so the next thing we need to do is before we start doing all these calculations and everything is we just need to get our facts okay our numbers ready so we can do these calculations we've already got the count of opportunities by doing the get records and assigning it the value of that count to a variable but we haven't done the voucher yet cool so let's go back in here and um do our get drag our get records function there and we're going to name this voucher count to make it very straightforward as always and we want to go to the voucher object that we created before now as you probably can guess if we just left it like this it would just pull through all of the voucher records we don't want that we want it to be filtered by the specific account or just basically pull through the vouchers from the account that the user is in the context of in other words they're in the opportunity they've click closed one they're connected to an account pull the id from that account and just show me the vouchers on that account id great now in order to do that however this voucher object that we created that we looked at earlier we didn't i didn't mention at the time about any custom fields all we did was have this record be created using an auto number right now if i go back to the object that i created you'll notice in fields and relationships that i've got this account field that i created and you need to do this too if you're going to be following along with this now create the new custom field now i've just called it account and what this is is it's a master detail um record of the field sorry that's looking up to the account and this is important because what that means is that i can then reference the account id from this voucher record which is what we want to do when we're filtering things um we'll look at another video about creating fields and objects and things if you don't know but that's what we want to do okay we want to create an account um custom field on that voucher object that is a master data master detail data type field okay which is essentially if you don't know a lookup so you can click in there and it goes oh looks up all the accounts then goes oh that account and connects it to the account great so going back to this it means that when i have created that account field i can then type account ooh if i can spell click that there and then i can do equals and go back to my record dollar sign record which again is the instance that the user is in and pull through i've got the account id here great so now we're just going to pull through the vouchers on that account i want to store all records don't forget because we're counting them and we can just leave it as automatically store all fields done let's drag that there now these arrows are just effectively showing you the sequence of events so yeah do this then that then that doesn't matter we all we want to do is get to a point where we then make a decision but we need to get all the information um we then want to do the same as we did with the opportunity drag the assignment in because we're going to count the the number of records and assign it to a variable in this assignment we are going to call it uh assign voucher count make it as descriptive as possible i've spelt voucher wrong which means i've got it there as well wrong fine and then we're going to set the variable so which variable do we want to set the value of now i don't i've got that variable up count but i don't have my voucher count variable set up yet so we're going to create a new resource variable and we're going to call it um voucher count it says i've already got it there i've probably created on a different one uh let's just put number of vouchers that's this see this is why you should always draw it out and write it out before you do it and we want this as a number again we don't want any decimal places because even though the the division that we're going to do later will in some cases provide a rain a reindeer a remainder we want to make sure that the number is considered as a whole number so let's do done and what are we doing well we don't want it to equal a value uh we want it to equals the count of our vouchers voucher count think this is where i've called it voucher count i should have called it voucher list oh well you get the idea again always draw it out first you know what you're doing i've i've just done saved okay drag that across so zippity doodah i have got opportunity list assign the count to my um variable get the list of vouchers on the account and put the count of those against there done right the next bit we're gonna do is we're gonna do a decision so now i've got my information of how many records how many opportunities and how many vouchers i've got i need to also do this other step because the number of opportunities is a bit pointless for me as it is you know if it counts i've got two great um i've got five fine but what i wanna know is how many multiples of three are there because that's what i'm gonna assess ah multiples of three that's what i should have said uh multiples of three and use that number against the count of vouchers so to do that we can create a formula field as a resource if i go to my manager tab i can click new resource and in there i can create a formula and this formula i'm gonna call um up divided by three and now let's do the data type we want this to be a number no decimal places now for the people on this video who are still awake and watching it this far um just by putting decimal places to zero doesn't mean that salesforce isn't going to consider a number that has decimal places but i want to really what this is doing is just displaying it as a whole number if i was to show it somewhere which i can do if i'm testing it or debugging it but i want to assess i don't want to assess it as a decimal i want the number changed if it is a decimal into a whole number and for those of you that are good with excel will know that there is a function which is like a roundup round down or a ceiling floor function if you don't know what that is you can google it a bit more but it's you can google it but it's really useful um what we want to do is round it down to the nearest lowest number whole number so we want a round down or a floor function so what we can do first is insert a resource now i don't want to try and do this from memory and type it up and get it wrong because i will always do that but what we can do is we can select it from there it'll put it in below now what i want to do is up count okay that's the count of the opportunities that's our variable so i click that is put it in there great now i want to divide that by three so then i get the multiples of of of three in terms of the opportunity count there but like i said if i was to just save that and and this run it will be great it will show a whole number when i've got zero opportunities or if i've got three opportunities or six opportunities where it's exactly divisible by three however for where it isn't exactly divisible by three which will happen a lot um it will show up lots of decimal places so to remove that what i can do is i can do a floor function like i said just type the word floor in capitals i don't know if you could do it lowercase it shows up as capitals when i look it up um and if you can if you don't know this from memory you might be like oh wow your memory is so good it's not what i did to remember the syntax or how the flaw is um set out is by going to a custom field uh creating a formula field and looking at the formula function in salesforce and there you can see all of the different logic um or math functions that you can add in double click it and then it just shows you exactly the syntax and you just alter it so this is what it is floor open bracket tall parentheses and then obviously we've got a resource that we selected earlier and then forward slash which is the divide function uh character and then three and then close bracket parentheses done right so how do we use that variable that that formula sorry that we just created well we're going to use it in a decision so this is where it really comes down to it um we go back to our elements and we get the decision icon there drag that in now what do we call this um assign voucher question mark now question mark is you don't want to be using carrots as much but it's okay because the api removes the question mark and it just helps me understand what this thing is so this is really to figure out um do i need to assign a voucher or not now this first outcome order we can add more of them but we we just want the one for the moment because it's either yes we do oh no we don't it says new outcome don't worry about that you can change the label so we're going to say yes assign the voucher that's my i'm just going you could put a signed voucher please or whatever whatever you want to name it now the conditions so what will mean that we yes we want to assign a voucher so this is really where my brain needs to work properly so in the blabbing on that i was doing earlier on i was saying that we want to work out the multiples of of opportunities that there are multiples of three um which we've done so we're going to use that here and we want to assess that against the number of vouchers because we want to know if there's enough vouchers for the number of opportunities in multiples of three so therefore let's first pull in the resource for the number of vouchers great so if the number of vouchers is zero but i've got three opportunities three divided by three is one well then it's zero vouchers and one opportunity so therefore or one opportunity multiple so therefore i need to go ah i need i need a voucher so therefore i want number of vouchers not equals i want this to assign it when it's less than the up divided by three make sense hopefully um i'm probably not helping when to execute the outcome if the condition uh requirements are met or only if the record that triggered the flow is run to update is run to run it's updated to meet the condition requirements when the conditions are met that looks pretty straightforward to us let's do done let's now drag that into there and i just kind of did done pretty quick but the default outcome would just put in you know is yeah don't do anything but i'll rename this just to make it obvious if we do later on expand this more but you could just put no okay fine this is the big bulk of it we have now done the flow to the point in which we can assess whether we need to send a voucher out and send an email okay so well done you've followed me this far so we want to create the record here we go create record drag that in there and we want to create voucher because that's what we want to do how many records we want to just create the one uh how to set the record fields use all values from a record or create separate resources and literal values now the first one would be useful if we'd already done maybe a search for or generated some values from maybe a screen flow you know like a form that users filled in but because we just want to create the record from scratch and there is no data yet um we can just do this create separate resources and literal values what is the object it's the voucher object there we go and let's set the field values now if you think back to the voucher object there was not we didn't really create anything on there we had the auto number which is fantastic because every time a record is created it's creating a unique number for that record that we can reference in an email we also had though the account master detail lookup field and that was important because we wanted to make sure that we could count how many vouchers were against the account that the user was within the context of so therefore we want to create the voucher but assign it and attach it to that account in question so therefore we can see we've got the account field that's on there and then it's saying well what value do you want for that account field on the voucher record and if you recall in the previous video in the part one we can use this dollar sign record variable um that's a global one and it's looking at the opportunity record that the user clicked in to start the flow and then pull through the account id and assign that to the record the voucher record that we've got right now that we have created that new record that new voucher what we want to do is we want to get from that new voucher record the auto number the voucher code effectively that we're going to use in the email so let's go straight in and have a quick look at how we can do that and and this is what was something we do before we actually create the email by the way because we don't want to send the email without a voucher code of course now if we just go back into the um create records um element if at the bottom we didn't do this but if at the bottom you click to manually assign variables you'll see the ability to store the voucher id in a variable and then you can go to the variables and you go okay i'll store it in a new resource called voucher id but you'll notice that there is already a variable called voucher id from new voucher head scratch i didn't create that what flow is doing is it's automatically storing as a variable the id of that newly created record from that create record function because it knows i'm probably gonna want this somewhere in the flow if not no i'm done but it saves me quite a bit of work because then it doesn't mean that i need to go get records or faff around basically to try and find this voucher record in the ether um he's doing it for me so great i'll just do cancel on that because now i know that the voucher id is being stored here in this flow as a variable what i'm going to do is i'm going to actually get records i'm going to now that i know the voucher id i'm going to get a new i'll call this get new voucher okay and obviously i want this from the voucher object so let's select that and i want it to basically work when all conditions are met what am i doing i'm searching for the exact record and i like i've just said i know what the idea so i'm searching against the the voucher object id field which equals my variable that we have found has been created by salesforce thank you voucher id from new voucher brilliant um what do i want to store only the first record there should only be one and we can store all fields uh or we can choose and let salesforce do the rest or we can choose fields and assign variables advanced um there are a number of ways in which you could do this you can you know from the record you can store that variable in there you can select the variable to store the voucher fields so let's say which which voucher field do i want to store this is what i want the voucher name so let's now select the variable well we can create a new resource the resource can be a a variable and what should i call this voucher voucher code again there's different ways in which you can do this you can go back in the way in which we did it where you get records and then do an assignment but we'll we'll we'll do this this way um we want it as text it's going to be a text and we can click done we don't want a default value for it so now we've got a variable called voucher called code that will be assigned the name field value from the record that is found brilliant easy peasy click done and now let's link the two together and we should have our get record get the voucher get that name that's been created that auto number and fantastic we have done that finally we need to do our action this is the email let's drag it in there and you can see there's lots of different categories of things let's just do email let's just i mean you could do a number of things here likely what you'll probably do or want to do is get you marketing team branding team involved and you want to make it look all professional but for the purpose of this use case let's just try and do a simple email and done let's create a new voucher email a little case mail there we are um right okay so what we're going to put in the body you can use variables like i said branding blah blah you could do things something more sophisticated than what i'm doing here that could be another video now you can actually type in here hello and that's your body it will use that in the body but what we can do and this is a best practice thing you do a little bit more um sophisticated is we can actually just create a new resource but when we do a new resource from within this email template we've got text template here that you can select and now you can see that there's a little bit you can do it as rich text as well so a bit more sophistication there so uh voucher email template let's call this keep doing that capital m um right um what do you want to say um yo uh congratulations you've been you've um yeah been awarded this sounds like spammy milk awarded a new voucher to use on your next purchase chase there we go please reference this code groovy [Music] um groovy yeah lots of love whatever it's b2c lots of glots my goodness me lots of live um call widgets dot com kiss kiss kiss spread the love okay um what is my voucher code well yes we've got a variable now with that vouch code in so we can go to insert resource and we can look at all of our resources and we can go down to the variables and there we go voucher code boom dynamic so it will it will put that in there let's do done so now that is in there that's brilliant subject um whatever congrats new voucher baby maybe more exclamation marks i'm sure that'll get spammed in the spam junkie um right email addresses we can do a collection so if this is going out to lots of emails you know but in this use case this should just be the one email um now here's where you can get a bit clever with it as well you can use an email address that's on the account and this use case is about person accounts so you can click in here and we can get a bit clever as well we can store the email address we want to use in a variable somehow searching records yada yada but let's lose use these global variables as an example and you could go to the record the opportunity you could go to um the account and then you can look at maybe an email address that's on there now i have created blue peter style for those that are from the uk and know the program i've created one earlier yes an email address on the account to simulate because i'm not using person accounts to simulate having an email address on an account now you could go to um anywhere you can go to contacts or whatever and things like that if you've created a link to them it could be you go into the opportunity and that you've got specific um i don't know purchase an email or someone who you're sending the contracts out to and who are actually making the purchases you may have on the opportunity but let's just pretend you do it on the account so great we'll use the account email you could just bung in an email address to test it directly in here if you want but let's try and be a bit clever um now because we've created a template and it was enriched text it says here rich text formatted body um yeah so i don't know why you need to do this but let's just we need to put yes and then we go and use the the constant value global constant value true as in yeah yeah yeah we're using rich text man do it um send a email you could tell it's getting a bit late i'm getting a little bit crazy um send it address so this is you know who you're sending it from now you know again you can look at the different email addresses you've got set up in the org or whatever the case might be and you could just put directly in an email address that's already authorized i'm going to be a little bit clever and i want to kind of in this use case i'm assuming let's say it's the user that has triggered this process uh it could be the opportunity owner email address whatever but let's just use the the user now the dollar sign user means you know the person who's clicked close one and then we can go to that user profile and we can see there the email address on that user profile record click email and now that's going to pull through fantastic don't need to faff around with sender type there are different values we can look in another email about all of that we could google it but let's click done and then from there we can drag the connector in and yeah we're done let's save and activate right so to test this one out what i'm going to do is i'm going to go into an account fresh account we've got pyramid construction and against the account you can see i've got a couple of opportunities i've actually opened the opportunity kind of related list view here so you can see two opportunities and also in the account you'll see there's no vouchers and so i've got the vouchers empty there this is the view for pyramid construction vouchers related list um if i now just go to one of those um closed one opportunities just do clone and save that should trigger now the rule to create the new voucher record and to send my email well what do you know we've got an email come through if i click on that it will split screen it and you can see that it sent me an email yo congratulations you've been awarded a new voucher to use on your next purchase please reference this code and then we've got this code here which is 20 21 0 4 hyphen 66 and if i just close that email that's just been sent to me i can go to my vouchers i can see that that is the reference there 20 20 20 21 0 4 66 so they have it we have basically completed a full flow for a s hopefully that has been very useful for you um i'm not gonna lie it took me a while to kind of just work out the use case i've of course made a few assumptions you are using person accounts it's a b2c for your uh use case but that shouldn't matter this is the foundation of what you've seen there of how to basically do exactly what you've been looking to do which is to find some records trigger it on a certain rule or logic which we're using this a little bit of maths i guess to try and figure that out and then create a record and send an email with some dynamic merge values in there as well if you found the video useful please subscribe to the channel click the notifications bell and you'll be able to get more videos like this and of course please as some of you have been doing thank you so much engage with me in the chat in the description in the comments tell me if there's anything that you'd like to see in these videos in the content and hopefully i'll be able to help which will also your examples will help others in some of the scenarios that they're looking to try and achieve in their business now there's plenty of other videos that you'll be able to see on the channel and more as the channel grows and i get the chance to make more content so do click on the links up there and i'll see you in a moment thanks for watching and may the salesforce be with you
Info
Channel: Adam Foyston
Views: 999
Rating: undefined out of 5
Keywords: flows in salesforce lightning, salesforce flow, flows in salesforce, salesforce, trailhead, salesforce tutorial, no code, Salesforce, Salesforce Flow Designer, Process Automation, CRM, Consultants, Administrators, Developers, automation, salesforce demo, flow builder salesforce, salesforce training videos for beginners
Id: t17bTAjPb_w
Channel Id: undefined
Length: 51min 54sec (3114 seconds)
Published: Mon Apr 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.