Okay, going live. Hello everyone, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So today we are having day nine of Salesforce Omni Studio Bootcamp. And I have Abhishek with me. Welcome Abhishek on the platform. So like as you are following all the sessions of Omni Studio Bootcamp and nowadays like we are learning integration procedures, right? So today also we'll be learning the same. So I think two sessions already Abhishek delivered. So in one, we understood all the concepts related to IP. And in one, he connected IP with Dataraptor. So in continuation to that today, he will be explaining like how you can apply some conditional statements in IP, right? That we apply in Apex as well. So it will be interesting because now IP will be more complicated. So just be with us, understand all the steps. If you don't understand, then just go through the recording and try to implement it at your own, right? So I'm assuming whatever sessions we have done, whatever use cases we have implemented, you have practiced them and you have understood whatever is being explained, right? So moving on to the next slide. So I just want Abhishek to introduce himself because I know in every session, lots of beginners and unknown folks are attending. So I just want like everybody should know who is the instructor, right? Whatever number of, whatever session they are going to watch, right? So go ahead Abhishek. Yeah, thank you Sanjay. So, hey everyone, myself Abhishek and I'm working as a Salesforce and Velocity Developer in Salesforce community since five plus years now. And I am a double, a trailer, double star ranger and I have done some certification on Salesforce, like OVNI Studio Developer, CPK Specialist Service Cloud PD-1 and Administrator. And I have done several projects in my five plus years of experience on Velocity as well as Salesforce. And if I talk about specifically Velocity or OVNI Studio, I have worked upon like a health insurance industry, telecommunication industry, CPQ industry, CPQ. So this is my brief introduction. Yeah. Okay, so moving on to the next slide. This is like telegram group which you can join and here more than 3000 folks are connected. They are interacting with each other, helping each other, solving some problems. And whenever there is any new vacancy, so those information are being shared there, right? So you can join it. And if you want to receive all notifications timely, so on next slide you will find all the social media handles. So you can join Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram, Telegram and all the session tracker links are available in the description of this video. Okay, and please provide some review or feedback, right? So that we can improve if there is some improvement required, right? And before starting, like once again, Abhishek, I want to wish teacher's day. Like you are by profession, not a teacher, but now you are delivering your knowledge to the community.  Happy teacher's day. Thank you. Thank you, Sanjay and same to you as well because by doing this live sessions with you, I am also learning a lot of things, like how to deliver sessions because when I'm working as a developer on any sort of project, then it's a different case. But when I have to make the things understand by someone other or some other human being, that's a different kind of scenario altogether. So it's a good thing that I'm able to learn with the help of your YouTube channel and with your guidance. So happy teacher's day to you as well. Thank you Abhishek for your kind words. Okay, I think now we can move ahead. Yeah, so if, yeah. So as we have seen in previous two sessions, like in the first session, we have seen what kind of things available in the integration procedure why we are doing integration for teachers, right? So if I brief you again, so whenever you want to write some business logic, so I'll take the example of Apex again. So in Apex, we are using all the DML operations, IsoQL operations, but to do or to perform some business logic around that data, we need to write some, let's say, if else conditions block, loop blocks, try catch blocks, right? So these sort of business, to build these sort of business logic or build some requirements, we do write the Apex code. So integration procedure is kind of Apex code when we talk about the Omni Studio tool, right? So in previous first session, we have seen what kind of elements available in the integration procedure when you are creating an integration procedure, how you can create it like with the combination of type and subtype and IP will get identified uniquely and we have seen how to call a data rector extracted from an IP to fetch some data from database. Or if I want to save some data or update some data to the database, then how can I do with the help of integration procedure, right? So I mean, till now, till this point, I mean, we have covered like the basic of integration procedures, how to fetch some data, how to save some data to the database or how to configure integration procedure when you are creating a new IP. So in today's session, I'll try to cover two things which we also learn when we are learning the Apex codes. So first is if conditional blocks and the second is loop blocks. So let's say if you want to execute some data rectors, let's say in the Apex, if you want to execute, let's say 10 line when a certain condition is getting full fit, that kind of thing, how we can do into the integration procedure. Or let's say if you are fetching some database from the database with the help of s of well in Apex, then how you can loop through it? I mean, if you want to build some business logic around it, so how we can do it in the Apex? So that's the similar thing we're gonna see see it into the integration procedure today, right? So if I go to the next slide, I mean, first and second example, we have already covered in the previous session. The third example we will be covering in the next session when we will be calling an Apex class from an IP. So for seeing the example of conditional block, today we're gonna implement or I'll show you the practical implementation of how we can use the conditional blocks into the integration procedure. Okay, so let me go to my arc. So I'm already on OmniStudio app and the OmniStudio integration procedure I have already on the tab of integration procedure. So I'm gonna click the new button and here, I mean, as a part of creation of integration procedure, we have to provide the name. So let's say I'll call it as create, create account or contact, okay? And I'm gonna give this the type and subtype can be, let's say, as object and subtype can be like account or contact, okay? So it indicates that we're gonna fetch the information from the database on the basis of input, okay? So if I explain you again what we are, what we're gonna see in this example is, so from the input parameters, we're gonna pass two parameters. First is fetch the account details or fetch the contact details. So how are we gonna do it is like account, sorry, account true and contact false. That means I'm telling this integration procedure to fetch the account details. If I'm making the account false and contact true, right? That means give me the contact details, not the account details, okay? And now in the integration procedure, okay? In the integration procedure, we're gonna see how we can use that conditional block. So from the left-hand side in the available components action, I'm gonna drag and drop this conditional block, okay? And let's say I'm gonna change the name of this like conditional block dot contact. And here what I'm gonna say is whether the account is equals to true, okay? And similarly, I'm gonna have one more conditional block, which will say conditional block contact. And in this, I'm gonna say that, sorry, it should be equals to true, right? If I'm passing the account as from the, if from my input parameter, if I'm passing account as true, then this will get executed. And if I'm passing the contact as true, then this action will get executed. Now, what are we gonna do is, we're gonna drag it data after extract action into the both, in the both conditional block, okay? So that's, I mean, if you see, if you focus on this in the middle section, I can add as many elements I want to add in this conditional block. I can do anything. So you can, now you can imagine it as a apex. Let's say you have started if statement, right? Then when you start the curly braces and in between that curly braces, you can write as many statements you want, right? So let's say, if my account active is equals to yes, then I want to insert the opportunity. I want to insert the code. I want to insert some projects. Then all those statements can be written under the same if condition, right? So that's the same thing we are doing over here as well. You can consider this block as your if condition. And in this, you can consider all these things as part of your conditional block code, similar to your apex, right? So for example, right now I'm gonna delete all these because we don't need it. And let's say I want to fetch the account in permission, okay? Account records. I'm gonna call it as account records. And from here, I'm gonna call the DRE accounts. And in this one, I'm gonna call this as contact records. And I'm not sure if I have a contact. Yeah, I have DRE contacts, okay? Now if I go to this DRExtract accounts and if I see if this data is expecting any sort of input, yes, it is. So I want to pass some sort of parameter which is used as like name like param. So if I'm passing as test, so all the accounts whose name starts with S will come. Sorry, whose name starts with test will come into the output, okay? And so what we have to do is we have to pass this pattern as well. So I'm gonna hard code it once. I'm gonna call it as param. And similarly, I'll go to the data rector contacts, data rector extract of contact. And it is also expecting a name param, right? And this is how, I mean, it is kind of similar to account. So here also we're gonna pass this parameter which will say add now, okay? Now if I go to preview, right? And if I click execute. So right now, the contact flag is true and account flag is false, right? And if you remember in the previous sessions, all the outputs, whatever we are using in this structure, all the outputs of these elements, we can see it into the type of logs. So now if I go to this execution sequence, so my contact is true. So it is saying, first of all, it will execute the conditional block of contact, right? Then it will execute the conditional data rector which is under your conditional block. So this is your execution sequence. So in the integration procedure, you have a facility to see how your integration procedure is getting executed. What is the execution? Execution sequence, right? Now below that if I go, so I mean, in the previous session, we have seen there are two sections created for each element in the integration procedure. So first one will give you the output and second one, in the second one, you will be able to see what input is going on to that element. In our case, it is a data rector extract. So name param as add now, this is the input that we are passing to this data rector extract and the output which is coming from this data rector is this. Name Adna Frank. So we are receiving three contacts, right? Now what I'm gonna do is, I'm gonna pass the account as true and contact as false, okay? And if I click execute and if I go again to the execution sequence, now the conditional block of account is got executed and data rector extract of account is got executed. And if I see the input, I'm passing the param as test and if I see the output, we are receiving all the accounts whose name starts with test, right? And what if if I pass both as true, execute? Then if I go to execution sequence, first the account one will get executed, then contact one will get executed, okay? And in the below debug logs, I can see the account output as well as the contact output. Now, if you all remember, whatever output we are seeing in the debug logs, it's not a output of your IP, right? You can consider, I mean, if you remember in the previous sessions, we have seen if you are not using any sort of response action into your IP, that means your IP will be working as a wide method. There is no written type of, there is no written type to this method, right? So if you want to actually receive some output from your IP, because whatever output you are seeing in the debug logs, that is not your IP output. This is your debug log so that you can, if you are facing any sort of problems, you can see from the debug log what's the issue. But there is no output for your IP. So for adding a written type to your IP, we have to use the response action, right? And in the response action, I mean, I'm getting the output with the help of additional output response, and I'm gonna say the node name is records, and I will open this FX and I will say, so now we can use this formulas as well, right? So I'm gonna say that if output is coming from, like if the input flag for account is equals to true, right? Then give me the output from account records, which we have used previously, account records, right? And so how this if will work? First of all, you will write the condition. So if you write the condition like this, if account is equals to two, then give me the output from account talk, and so this is your condition, then this is your true part, then you will be having the else part. So in the else part, what we can say is, give me the output from contact records, because if account is not true, then contact will be the true, right? And if I click okay, and whatever output is coming from this formula, I am passing it into the records node, okay? And now if I go to preview and click execute, sorry, so what I'm gonna do is I'm gonna pass the contact as false, and now if I click execute, so I mean, there will be no output added to the response section. I mean, we will test it, whether it is coming or not, but it will not come. Okay, just give me a second. It is saying, yeah. It is showing account info. So basically, yeah, I think, yeah. So what happened is, I mean, when we passed the account as true and contact as false, right? So whatever we have received from the account output, account records output, right? This account, this whole node is getting passed into the records node, right? And if I pass as account as false and contact as true, right? Then what will happen? I'll be getting all the contacts. So right now we have only one contact, that's why that is having, that is available under records node only. Yeah, exactly. And if I go to the response action, we are receiving that contact. And if we will be having more than one contact, so that list will be created automatically, right? Correct, correct. So this is how it is. And now there will be confusion. Let's say if both of them are true, right? So what will happen? So right now our condition is like, if, did I delete it? Oh, my bad, I lied it one again. Instead of just clicked on trash. Yeah, no problem. Yeah, because of this expression, like anyone can be fetched. So if account is true, so account will be fetched. Account records, else contact records. Contact records, I'll click okay. And again I'll go to the preview and click execute. So right now what is happening? The account and contact, both of them are true. Right? So if I go to the FX again, so my account is true. So it will never go to the else part of the formula. So this will always return the account records on you. Right? Right. So like if you want to get both the results and what you can do is you can create a separate formula. So let's say if account is equals to true, then give me the account records, otherwise give me a null value, right? And you will call it as like account records. And if you want to get contact records as well, then what you will say is, if contact is equals equals true, then give me the contact records, otherwise give me a null value. And I'll click okay. And now if I go to response, and if I click the execute button, then in the account records I'll be having all the accounts and the contact records I'll be having the contact records, okay? And let's say if either one of them is false, then for the second one, there will be null values coming. So that is how you can use the conditional block into the IP. And if you want to use FL conditions into your formula, this is how you can use it. And just from a developer's perspective, this contact will be always holding either the true value or the false value, right? So if you are using a Boolean variable into your if condition, then you don't need to add this equals equals true. I mean, that is not needed, but I mean, just for, if we will be following the best practices, then we don't need to add this equals equals true, because this account or contact flag will be always holding the true or false value. Okay. Because these are Boolean, so we can write them directly. Correct. I mean, Sanjay, do you want to do some sort of brainstorming over here? Yeah, so just one curious question. We created conditional block separately. So can we implement it in such a way so that it will look like if else block? Yeah, that also we can do that. So let's say this is my first conditional statement. And this is my second conditional statement. And if I remove this condition, right? And if I check this checkbox is if else block, right? Then what will happen? If your, this condition is getting fulfilled, then this one will get executed. And if this one is not getting executed, then this will be your else block. So now what will happen? I'll not pass this contact as true or false. Okay. And if I click execute, so you will be seen. Oh, okay. Oh, I got it why that happened. I mean, what we're gonna do is... I think that checkbox didn't check is if else, okay. Enabled contact, okay. So by default, I mean... So what if we enable that else checkbox in first condition? Yeah, I think it's if else block, okay. Go pay room and if I click execute, I think not and if I click both of them. I mean, it was like that, this is your if block and this is your else block, okay. Let me go to execute and see again. So it is giving the output for both and that should not be the case. So conditional of this one is getting executed and then this one is getting executed. And, okay. I think Sanjay, I need to try this scenario into my other org because I have faced some sort of, you know, package installation issues in this, this org previously as well. Okay, no problem, but I think it can be done, right? Yeah, so I mean, how it can be done is like, this will be your if block and this will be your else block. So you need to check this checkbox is if else block. So this block will become your else block of the above conditional block. Okay, the just above conditional block, right? Correct, correct. And if we have one more, like third one, so again, we need to check the checkbox. So it will become if else later. Right, yep. Okay, and this response action is basically providing the filter to data. Correct. Right, and like if we connect it with any omni script or flex card, so do we need to use this response action one mandatory or without you know it, we can pass the data? So basically, if we are creating the IP and if we are not adding the response action, right? Then there is no sense of calling this IP from either from omni script or flex card. The reason is whatever statements are getting executed in your IP, this will never be available as a output of your IP until and unless you haven't added the response block, response action. That is why I said it in the initial part of this IP that if you want to add a written type to your IP, then you have to add the response block or response action. Okay, so if you want to pass some data from this IP back to any other element or tool, so we need to use this response action mandatory. Correct. Okay. I mean, because whatever you are seeing over here, these all things are available as a debug logs. This will not be available as the output of your integration procedure. Right, understood. Right? So there is one more thing that I wanted to convey. Like if you want to use one or two, one or more element with the same condition, then you should use the conditional block, right? If you want to use only one element and if you are using the conditional block, then there is no sense of doing this. And the reason is if I drag this data after extract outside of this conditional block, right? I can add this conditional directly into this element as well. Sorry, not here. Here, execution sequence formula. Okay, execution conditional formula. Right. So I mean, if you want to use this same condition into your three or four or two elements, then you can use a conditional block so that you will be writing the condition at one place only. Then all the elements can executed under that block. But if you want to use a single element with the condition, you can use it directly over here as well. Okay? Yeah. Now what we're gonna do is, yeah. So I think we can see one more example today of using the loop block. Yeah, okay. I think that will be great. Yeah. So why do we use loop block? The reason is, let's say if you are fetching some sort of some sort of list from your subql into your epics class, right? And if you want to loop it through all the records that you have received into that list, then obviously you have to use the loop block into the epics class. Similarly, we will be using loop block into the IP if I want to use, if I want to iterate on the list of records that I have received from the data app, right? So for using this, what we have to do is, so for example, I am receiving the output into this account records, correct? In the above section. So whenever we are using the loop block into the epics, in the reference variable, we have to pass the listening, correct? So how do we write it for, then we start with the data type, let's say account, then the reference variable colon, and after that we have to give the listening. So over here as well, in the loop list, you have to give the listening. I mean, on which list you want to loop through or you want to iterate. So if I go to preview, and if I see the account records output, I'm receiving all the list of records into this account node, right? And which comes under the account records. So what I have to say is, account records colon account, right? Now, what let's say, for the business case, what I want to do is, whatever name I'm receiving in that account list, I just want to add a, let's say one, two, three at the last of the, each and every account name. That can be one of the use case, right? If I want to iterate on the account list, and I want to modify the account name, right? So how we can do that? I'm going to use a set values, right? And in the set value, I'm going to create a new variable. Let's say, modified name, okay? And here I'm going to say, for example, I'll click the effects and I'm going to use the concat method, okay? Because if I want to add some sort of one, two, three as I string it to the name, then what I can do is, I will say, account records colon account, colon name. And what I want to add, one, two, three. One, two, three, right? Click.  On which list you want to iterate. And into the set values, you are creating a new variable named as modified name. And in that variable, what you are doing is, you are appending one, two, three at the last of every account's name, okay? And now, you will be, obviously you want to output from your loop block, right? Because if you have added the modified name, it will not give you the output. For taking the output from the loop block, you have to add this, you have to add one element into the additional loop output. And here, you will say that modified name. And now, over here, what you will say is, percent percent, set values one. And what new variable you declare, modified name, correct? This is how you can do this. So now, what will happen? This loop block will be having the input of list of account. And when this loop block will go inside this, then it will create a new variable called as modified name and it will concatenate one, two, three at the last of name of account record. And then it will come back to this loop block output. And it will give me a new node named as modified account name, which is coming from this set values one colon modified name. And now if I go to preview and click execute, and if I go to output of this loop block, you can see I'm having the modified account name as a new list, a new node, which is having one, two, three at the last. One, two, three, one, two, three, right? And it is giving me two more things. Yeah, sorry, Sandeep. Yeah, go ahead. Sandeep, your voice is big. Yeah, okay. So I was just saying, I mean, we have received the new node name as modified account name, which is, in which one, two, three has been added at the last for each and every name. And it is giving me two more things. First is loop block iteration index and second is set values one status. Again, loop block iteration index and set value status. So if I go till the last, we have 13 items into my account list. So it will iterate for 13 times. And what is this set values one status? So whatever element we have used into the loop block, whether this statement is got executed or not. So this status means this one got executed. So for all of them, it is getting executed, right? So any confusions in that Sanjay or if you have any questions? Yeah, I think it was straightforward and understandable as well. I understood this concept. And I think if folks will be doing some practice, then they will be able to understand more clearly. Right. And maybe like we can draft some examples because in current scenarios, we don't have any have some more scenario so that they can practice. Yeah, I think we can definitely do that. Okay. Anything else that you want to cover for today? So I think for today, I mean these two will be enough because if the viewers will be doing the practice for this conditional block and loop block, then this will be a bit confusing for them when they will be doing the practical implementation. So I don't want to burden up with some other elements. So I think that would be enough for today. Okay, guys. So I think everybody understood how you can implement conditional statements and how you can implement a loop on a list. So this loop block is basically implemented for iterating all the elements which are available in the list. So this was a simple example and we will be having few more examples, those you can practice. Okay. And you can see like how systematically in IP, we just need to place the components and they just execute one after another. Right, Abhishek? Correct. So I mean, there is one more thing I can say that whatever examples we are seeing, right? For like this conditional block, this is just to give you idea or give you the brief why we are using this all and how and why we are using these elements into the IP. I mean, real-time examples will be a bit different. I mean, there will be never be the case where you will be having a new node into the loop block. So this example, I just give it to you so that you can understand the concept. So yeah. Right. Okay, so I think it was a great session. So Mukesh saying this word. So I'm also saying like great explanation and you covered everything with step-by-step explanation. So guys do practice so that you can understand whatever Abhishek explained and let us know if you face any difficulties and like we will be having one more session where Abhishek will demo you like how you can connect your IP with Apex. Okay. We'll try to have some unsolved scenarios for you so that you can practice. Okay, so with this note, we take your leave. Thank you so much for joining this session and those who are watching the recording, thanks to you as well. I hope you are following all the sessions. So please share some reviews or feedback and keep watching. Thank you Abhishek for sharing all the insight and people are like learning Omni Studio and soon I think like if they follow everything they will be able to clear the certification as well. Yeah, definitely. Okay. Thank you everyone for joining the session. See you in the next session.