Multi Screen Flow | Day 4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone welcome back to apex hours my name is amit singh and we are in day 4 of our flow builder series so today's session is more alike going to be the real-time implementation that we are going to implement here as you all know that in the previous videos in the previous sessions we have mainly worked with the screen element screen flows so this is going to be our last video for the screenflow here is a scenario which we are going to implement is of epic servers is working on salesforce and they are facing some issues like the users are creating the opportunities but opportunities are not associated with contacts with the opportunity contact roles so as a solution as a developer what you need to do is you need to create a screen component by which user can create account contact opportunity and opportunity contact role at once so the key here is you need to create the contact you need to create the opportunity and if user has created the contact and opportunity you need to create the opportunity contact role that means approach contact opportunity on opportunity contact rule should be created at last you you will not be creating like you have the contact information then you you will not be using a create record over here between contact and opportunity and similarly between opportunity and contact role you will not be using any create record element what you will be doing over here is you will be creating getting contact information you will be getting opportunity information and then after you will be using create record to create record over here for creating a record and then you will be creating opportunity contact role over here and there is one additional thing that we are going to use over here is in the contact we have got address right we have got the billing address so we are going to use a get record element to query the current account where we are in and then add those the shipping address of our account to the billing address of our contact record so this is basically uh what we are going to implement today so without making any further delay let's quickly start so as we all know that from the previous videos we have already talked about how to create the screen flows and how to navigate to the screen so i'll directly start from screenflow and then we'll use whatever the auto layout or whatever the free from that you want to have the very first thing that we have to do is we have to create a variable in order to accept the record id from the account space layout so we'll say that record id data type is going to be text available for input click on done then what we need to do is we need to go ahead and use a get record element because we wanted to have the account information so that we can query that addresses we can use those address into the contact address so just go ahead and say that to get record or what you need to do is you say that get account record api name i will say that gr which is saying that get record and i say that get account record object is going to be account because we are going to make a query on object the filter we have to say that account id it is going to equal to the variable that we have got record id by default we are going to store only one record because we are filtering based on the record id then automatically store all the fields and just go ahead and click on done you have got to get record next thing that you need to have is a contact information so just go ahead add an screen over here and the name will say for contact information and then here we have to take few inputs like we have to take the name so just go ahead and say over here we've got the name we have already talked about this okay and then we have got to email so we'll use email over here below name we said that okay we've got email and then we will also use spawn and we will make this as a required okay so we'll go ahead and say that this is also required and email is also required so we'll go ahead over here it is saying false by default it is false we'll just go ahead and say that required is true and then after that what we are going to do is we are going to have the address address is going to come over here so we say that it is going to have the billing address we've got the billing address okay this is basically going to be the api name and then what we will have we have to provide the values like city value so from where we will provide you already have got account record and then we have got sleeping city so we'll say that shipping city for city values similarly for country what we will say is we've got account record and we will use shipping country and similarly we are going to use for other values as well so what i have done is i have provided the values whatever we are getting from the account we are mapping to the account a contact address okay now we are done just go ahead and click on donel done over here next thing that we need to have is we need to have a again one more screen where we are going to have the opportunity information so we've got the opportunity information then what we need is first thing we need a name so we'll say that okay this is not going to be the actual name we will use text because this is going to be the text so we are going to say that okay label is going to be opportunity name make it required then we are going to have a date field which is say that opportunity date which is going to basically have the close date it is also required then we will have stage which is going to be a type of pick list because when you create an opportunity stage is a pick list so we will say that it stays make it a required and as we already talked about how to create a picklist choice set so we'll say that it stays name and we will just follow whatever we have learnt into the previous lecture so we have got the stage and then we can also have some sort of description which is going to be the text area along so we'll set a text area along and say that description we are not using one thing we are not using over here is basically the account right because we are getting that account from the record id but if you wanted to have you can have say that you wanted to show the account you can say that okay you've got the lookup after opportunity name you can say that account name field api name is going to be account id label is going to be your account name object api name whatever your child object is which is opportunity record id we already have a record id that is what we have and then that is if you have a required you can say that yeah it is requiring so say that required as a true now what we have done is we have used contact information we have used opportunity information now what we need to have is we need to use a create record over here to create the contact to create the opportunity and then we use create record for creating the opportunity contact role so we'll just go ahead click on a create record over here so we'll say that create record and this is basically going to be the contact so that create contact record and i'll say that create record and then you can just have those api name according to you we have multiple records we don't have any collection right so what we'll do is we'll just go ahead and click on we want it to have only one record so we are going to use separate resources we don't have any record we haven't created any resource for object type so we will go ahead and click on let's say we have got contact we need to provide the field the first thing we will provide about account id then we will have last name we have first name okay then we have email phone and addresses right we got email phone say that home phone and then this time we have got address we will say that billing uh sorry shipping address we have city okay sorry it is mailing city so i've got mailing city then we have got mailing street we have got country then say state postal code so these are all the fields that we wanted to map so let's start mapping one by one for the name field we'll go whatever the name we have found and we'll say that it is not going to the first name it is going to be the last name so we'll say last name then here just copy and say here we've got it is going to be the first name email is going to whatever the email we have used so we'll say that email dot value phone is going to be we have used a phone element phone dot value and then for sitting we are going to have address and then we will say that city and then we have a street so we'll say that address dot whatever state we have so we have mapped all the fields that we wanted to map over here so this is one way of mapping a field we will talk about the other another way of mapping a field into the coming videos we have mapped this we'll just go ahead and click on done there is one record element right next we have to add one more record element so we'll just go ahead okay let's quickly i'm just going to decrease the size so that i can see actually that record element so we got create record this time we say that create opportunity again it is going to be one record separated values and then we have got opportunity and then first thing we have got account name then we have got opportunity name we have stays close date and then description so while selecting stays right you need to select the screen component which is not the people's choice set you need to select screen component select that for name we'll again select we have got opportunity name and for account id it is going to be the whatever the lookup we have so we'll say that account name and then its record id so whatever you have selected it can be the existing one or you are selecting a new record now we have got we have added basically opportunity as well now what we need to add is we need to add one more create record because we have created the opportunity we have created the contact now we need to create one more which is going to have the create opportunity contact role then again we have got the separate values this time we will have a contact role so we have got opportunity contact role to select this time what we have we will have we'll have contact id and then we will have opportunity id then we will have a role and is primary so these are all the fields that we have contact id will get will get from where we'll get basically contact contact id from our create record so we'll select this one okay and then we'll say that opportunity ideal select opportunity id opportunity id from create opportunity record that we have created previously then role we are going to select let's say that it is going to be the business user is primary it is going to be true because this is the first first ever contact which we are adding first ever role to the opportunity contact role that we are adding and then click on done just go ahead and save over here and we will name it as quick opportunity and again just to make sure that it is a correct one i'm just adding flow click on done okay so till now what we did is basically we have just added a happy path over we say that user is going to run the flow they will get the record whatever the account they are in they will provide the contact information they'll provide the opportunity information then create contact opportunity and contact role but we haven't talked about the error right the fault screen the error path which is going to happen which might happen so to do that just click on each and every element say that add default path and then here you can add your screen so we'll say that contact error and then use a display message over here display text okay so we will say contact error message and here what we are going to use is flow and then the fault message that we have already talked about because the fault message is something which is going to take care of the complete error or going to have the complete error for your particular element so you have got default path for contact create then you have got default path for your we'll say that what exactly it is happening is for your opportunity so we'll say that opportunity error and similarly we are going to do the same for our contact role so just go ahead and add one more screen element done so what we did is basically if i uh give it a space over here you can see what we have done is basically we have created an account sorry we get the account information we have taken contact opportunity information we are trying to create those into the system and then we are adding a fault path okay now what could be one issue over here is you might wanted to get back from here to the say that contact screen is somewhere error so you want to go to the contact screen so how you can do is you can connect to element okay you can use this connect to element and what you can do is just say okay uh which element you wanted to add this one oh sorry this is basically the wrong one we'll just go ahead and back we'll again click here we'll say that okay this is not the one we click on the plus icon okay what happened okay let's uh actually refresh the page so what we were talking about is collect connecting an element right so we'll just go ahead and click on this plus icon and say collect connect an element and what element we wanted to connect is contact so if there is any error comes at the contact screen label we can just quickly get back to the contact information similarly we can say that if there is any error comes to the opportunity label we can go to the opportunity and then similarly if there is any error comes to the opportunity contact role label we can get back to the contact information so you can see here this element is connected twice and this element is connected only once if there are any errors and all so this is basically how our flow is going to look like finally once we have completed the flow so again just to give you the quick overview it's not that complex it is very easy what we are trying to do is we are trying to get the account record populate the address information into the contact mailing address take the opportunity information then create opportunity and contact and also create the opportunity contact roles if there is any error while creating any of these records just show the error message and then once the user clicks on next they can quickly get back to the contact information or opportunity information based on what particular error they are in okay now what we'll do is as a best practice we'll always use a debug and to get the account record id we'll just go ahead find the account record id and we'll use that record id as an input so before we go ahead and debug it go to the detail information and we need we need to make sure that there is some information at the shipping so basically we have got we have got information at billing address so we'll say that shipping we also need so for that what we will have is we'll just copy what exactly is there in the shipping so we'll say that okay whatever you have i'm going to copy to the other sipping address as well so that we can also see the address information which is being populated at the contact level now to debug here just go ahead and provide the record id and then click on run so now you can see here we've got the first name we've got the last name email is something phone is something and we have got the address which is already auto populated so we can say here is flow and we say that contact and we'll again use flowcontact.gmail.com somewhere provide some dummy phone number click on next so till now there is no information say that there is no record which has been sent to the salesforce system so now what will say that flow opportunity with role okay just to make sure that the name is basically differentiating the opportunity which we are creating we can create whatever we want say that needs analysis and we again say the same description over here and then click on next now once we click on next it is going to create your contact it is going to create your opportunity and contact role as well so if you see on the right hand side you will be create record okay first thing let's talk about this particular screen element for opportunity information this is what we have given as an input then we have got create record for contact this is the record id then we have got a create record for uh our what we say opportunity this is the record id and then for our contact role and this is the record id transaction has been committed to the system now if we wanted to get back to our account record and wanted to make sure that contact or opportunity has been created i will just go ahead and click on view all i got this opportunity i will just go ahead open that opportunity to see what all information is there so you can see the stage whatever we have selected and this is our contact role which we have created that means one contact also has been created under that opportunity as a contact rule so that is what the requirement was for our creating like what what was the issue for apex hours which they were facing and how we are going to resolve that before we go ahead there is one more thing which we are going to test over here is suppose that we don't provide any information we are just going to have flow contact gmail.com this is basically just a simple information which we are providing but as we know last name is always required for creating a contact we wanted to get into the error so we whatever we are going to provide it is not going to get into the system so we can just go ahead and click on next so now you can see here it is saying that required missing last name we already talked about we'll talk about this uh basically trimming up this particular api link click on next so once you click on next you will get back to your flow again so that's why we have used this connect element this connect element for our particular flow this from here to go to the contact from here to go to the opportunity from here to go to contact like this so that is how now next thing that we have to do is go ahead and activate this once you have activated again we need to follow the same process go to the account record not account record basically go to the account object from the object manager create a new action from the button links and axes and here what we are going to do is we will say that okay we are going to use a flow and we will have quick opportunity flow and we will again say that opportunity with role so we have got opportunity with role go ahead and click on save again we have to add this action into the page layout if we don't add we will not be able to see this action into our record page where we are able to click on that button and then pop-up is going to pop up so you already know how to basically follow the process what all accents we need to add we just need to go ahead and add that and then once you get back to the record page you will be basically able to see that button and then you will be able to test that record from there itself so after adding that action if you refresh the page right you will see that button is there opposition with role and by clicking on that button you will be able to see the pop-up whatever we have seen into there and then we can just go ahead and add say that i mixing whatever i wanted to have i wanted to provide my email i can just go ahead and provide the information click on next and we'll say that new opv which is going to be new opportunity you can have whatever the close date you want you can have this days whatever the description you wanted to have so that this is the test description i click on next so once everything is done it is going to create and it is going to basically close that pop-up and you will be able to see your contact over there so if you go there into the opportunity which is going to be new opportunity is the name so you just go ahead open that opportunity and you will be able to see the contact role under that so that is how you can have that one thing that you might have noticed is the pop-up is automatically closing once that particular flow is completed so if you wanted to show the success message you can go to your flow and at the end you can just go ahead and add the message so that you can have that success screen so you can have the message like this the opportunity has been created or an opportunity has been created click on done then you have got save as click on save and then you can have the say that okay click on activate so this is it for this video and thank you for your time thank you for giving us your precious time if if you have missed the previous videos please find those video link into the description of this video and also please don't forget to like share subscribe the channel and in the next video we'll talk about what are the auto launch flows and how we can work with auto large flows thank you
Info
Channel: Salesforce Apex Hours
Views: 4,820
Rating: undefined out of 5
Keywords:
Id: 1mtIBH8zziI
Channel Id: undefined
Length: 27min 30sec (1650 seconds)
Published: Thu Sep 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.