 Okay. Going live. Can you just change the slide actually? Forgot to change the title slide. Okay. So hi everyone. Welcome on Sanjay Gupta Tech School. I am Sanjay Gupta and I have Abhishek with me. So welcome Abhishek on the channel. So today we have one more session on Omni Studio and this is episode 7. And here in this session Abhishek will be explaining few more scenarios related to integration procedure. So in last session also we understood three scenarios related to integration procedure. So few more scenarios he will be implementing today. So no theory. All practical implementation so that you can understand like how different functionalities you can implement in Salesforce Omni Studio. Right. So over to Abhishek. Hi everyone. So myself Abhishek and I am working as a Salesforce Velocity Developer since 5 plus years now. And I am a pre-laired double star ranger and also I have done some certification around Velocity as well as Salesforce. And few certifications around like Velocity or Omni Studio is Omni Studio Developer then. Industry CPC and also I am holding one certification of Velocity which is as a coding developer. So that's it about me. Okay. So moving on to the next slide. So if you want to become part of a community where lots of freshers and experienced folks are connected. So you can join this telegram group. And if you want to share some feedback, whatever sessions we are doing. So please feel free to share those in the comment section. So we have, if you can go to the next slide. So we have six scenarios that you will be learning. Right. So all these scenarios are related to integration procedure. While Abhishek will be implementing these, so you can relate like if these problems are available in Apex, how you will be implementing them. So similarly, the replacement of Apex or coding stuff is basically integration procedure where you can implement all like logical building. Okay. So let's start with a conditional block implementation in IP. So over to you Abhishek. So let's just directly jump into the part. Basically, yeah. So for the first scenario, which is conditional blocks. So it indicates that if we want to execute some sort of functionality on a particular condition. Okay. So I'm going to create an IP first. Let's give it a name like IP demo, let's say demo of demo boos. So there is one, one thing called, which is called as conditional block. So basically what will happen in this one, you can write down any sort of condition. Let's say I want to say that a fetch account should be equals to true. Okay. That means we, I mean, like this, this block will only execute when, when this fetch account will be true. If it is not true, then this conditional block will not get executed. So just to make a scenario, what we're going to do is we're going to use some, we're going to call two data refters. First is data refter, first data refter, which will fetch the account records. Second data refter, which will extract the contact records. So if I go here and let's say I'm going to use a data refter, which is like TR extract account, for example. And as part of this data refter, what we want to do here is we want to pass a param value. So I mean, like this, these all should make sense to now because we already have gone through all on this one. So we tested ZTS one. Okay. And if I go to preview and click execute. So from the data refter, okay, there is no output because I think let's go here from the data refter. And so the name we provided test as ZTS one, so it was not available. No, no record is available with that name. Yeah, I think, yeah, so we have the records with this test, which is in caps value. So I'm going to do this. So now, I mean, like that question arises when basically we have the execution conditional formula in the data refter extract element also. So the thing that whatever we have written here, we can write over here as well. Right. So why there is two things conditional block and execution conditional formula. Right. So basically what will happen, let's say you want to you want to call five data refters on a particular condition. Right. So if you're calling those five data refters, you have to write this condition in each and every data refter element. Right. But whenever we have a group of elements that should be executed on a particular condition, then the better approach of developing is developing that functionality is using the conditional block so that you will write the condition only for once. And in that you can you can have multiple elements like this. So like now if I remove this from here, and so basically now what will happen if I'm going to add let's say one chapter action in this conditional block, let's say one delete action in this conditional block. So these all things will get executed only and only when this fetch account will be coming as true. And this this fetch account is a variable. Yeah. This is a variable that we're going to pass. Yes. Okay. And from where it will be receiving the value from input. So preview. Yeah. Yeah. So basically I mean like for testing the IP we will be receiving the value from the input but in actual we will be passing this variable from either from a script or flex card. Okay. Understood. So let's say this is the one conditional block. Let's say we're going to create one another conditional block where we're going to say like fetch contact should be true. Contact. And for this data actor. Let's say we are going to call. This that's a contact. And this data actor is expecting a name. I think so. Yeah. Name param which is okay. We have to pass the account name over here. So in this data actor what we are doing according to this variable we are we have a where clause on the account name. So if I go here and simply. Now if I go to preview right if I go to preview and click execute there will be. I mean like I mean like both of the data actors will not get called. The reason being is we have added the condition fetch account and fetch contact and that we are not passing. Right. So I I'll go to preview again and I'm going to add one is this one is contact. Let's say contact. I'm going to pass it as all for now. And now if I click execute. So in the debug now you can see the. Are they are except for account. If I make it this true and the other one is false. Execute. Now data actor extract to action is getting executed and this is giving me the contact details. Right. Okay. And what if we pass both as true. So both the list will be ended. So both will get executed. Okay. Right. So yeah in different extract actions action one will be having one list and action two will be having another. Okay. Correct. So this is how we can use the conditional block and it's better to use conditional block whenever you want to. I mean like on a particular condition you want to execute multiple elements in the IP if you want to use. If you want to execute only single element and it's not a good approach to use the conditional block you can directly write the condition into the execution conditional popular. Okay. Okay. Yeah. So that's the one thing. Let's jump on. Another question the result which we are receiving. In form of list. So that result we will be using either in the omniscript or a flex card right. Exactly. Yes. So the same way the data rector result we are using in IP and the IP whatever result is receiving it will pass it to omniscript or flex card so that this data we can show in the UI. Correct. So I mean like generally generally the flow also is like that I mean from your omniscript or flex card you call your IP and from your IP you call your data rector. Right. So this is how it works. So I hope yeah I hope guys with this example you are able to understand like how we can connect data rector multiple data rector with one IP right. So prior to IP sessions you were only implementing data rector. Now with this example you will be able to understand like what is the benefit of data rector and one more thing I want to highlight whatever data rector we are creating they are independent. So one data rector you can call into any number of IPs right. So this is the benefit of Omnis Studio. This feature is not supported actually in Salesforce flows in flows whatever elements you are using so that basically can be used in that flow only. But here data rector IP omniscript and flex card all are separate components so you can reuse them so that you can speed up your implementation. Correct. I mean that's a good example that you gave Sanjay like in flow if you want to use fetch records or I think get records elements in flow you have to use multiple times if you want to extract the records. But in the data in the case of Omnis Studio you can use your single data rector in multiple IP or multiple open scripts. So that's a good solution that Omnis Studio is providing. Now if we go to the next example next example is list action in IP. So basically what is list action okay. Now if we go here and if we see right with the name we have three with the name of test as just as just as we won we have three accounts. Correct. And if you go to the data rector extract two we are only receiving only one contact with the account name as just as one correct. So these two are coming into a separate list right now. Right. So here comes the user usage of list action. Let's say you have your account data in one list in your second list you have the contact data but in the in the contact data you have the account ID as we have over right. So we have a common key for both the list. Right. And now by using these I want to create a new list which will be a single list and wherever let's say this this account ID if I'm able to find in this one as we can see we can find this account ID. So as a result what I want is I mean like there should be another list created if I open the JSON block just give me a second. So in this JSON block what I want here is there should be a new list get new list should get created and what should be the output of this one. It should be like this. So basically this account ID will get matched with this account ID. And there should be a new list get created where if we have account contacts related to this account that should get merged with this one and vice I mean like so on. Yeah so you mean to say account and contact both information will be merged into a one list. Correct. And that will happen on the basis of a common key common key yeah that should be available in both the list. Correct. So now if I go to IP again and let's say here we have this list action. So how we can do is we have to copy the name of this conditional block. So first of all we have to add the list merge list order. So here we will say conditional block one then this so we have to paste basically element names. And if we see the result of this one is coming as easy list. Correct. So paste it here as easy list. Now second will be like this conditional block to data after extraction to and the output of the contact is coming like in context. Right. So this will be contacts. And now you have to select this checkbox advance merge and in advance merge you will click on this add merge map. And in this add merge map select the account list. I mean like whatever you have populated over here this will come as a drop down. Right. Okay. And in the matching path so if I go to easy list what is my common key which is the ID. Correct. So I'm going to select I'm going to type the ID over here and let's say matching group will be one I will tell you the significance of this matching group. Again click on add merge map select your contact one and in your contact one what is your common key this account ID type this over here and matching group will be one. So basically now what will happen we have created a map matching group where we are saying from the account list pick the ID from the contact list pick the account ID. And I mean like why the matching group for both of the both the conditions are same because these two are related to each other. So that is why we have we have did this. So if you see the description of this one as well assign an identical key to all nodes that may match for the merging to occur. So basically this and this matching should be come under the this matching group the one matching group. Okay. So you mean to say we can create another group. Yeah. Another mapping and we can we can give the matching group as two. Yeah. So pairing actually we are doing here. Correct. Yeah. Kind of. Yeah. Now again now if I go to execute and if you see the output of list action. Okay. Nothing came. And just give me a second. So we have this data rector DCC list. Then we have the data rector. Okay. I'm not sure but I think so that we don't need to use this one. Data rector. Data rector. Yeah. Yes. Now we can see that we just need to provide the node name actually right. Correct. Yeah. So I mean like you have to use the only the element name and whatever result is coming from it. So now as you can see the output that we were we were we wanted it is coming like that. So the accounts that do not have any out a contact it's doesn't it didn't get mapped with anyone but the account which have the contact we those those key value pairs have been merged together. Right. So that's the main advantage of using list actions. Yeah. And I think it is very useful if we have if we have called multiple data rector and if we want to combine the data. Correct. So basically sometimes what happened I mean like in this sort of scenario we always created data rector only where the contact an account will get. We get it from the extract data rector extract as a single single list. But sometimes in the real world scenario that happens I mean like the parent object is coming from another node and child object is coming from another node. So that in that case we have to combine them. So that is there. Now the next example is remote action in IP. Okay. So let me first drag and drop any remote action. So yeah. So basically what remote action does is sometimes what happened what happens your IP will not be able to do some sort of task with the help of all the configurations. So in that case we have to call the apex class. Okay. So when you want to call an apex class from your IP or omniscript then you have to use the remote action. So I mean like I have already created one apex class so I will. So whenever you want to call an apex class from an IP you have you have to implement one interface which is called as system dot callable. I mean like previously when velocity was not merged with Omni studio the interface was interface was a bit different but as soon as the they got merged I mean like they have introduced a new interface which is called a system dot callable. And in that system dot callable we have a call method which we have to extend or we have to define. I mean like if you are aware of interface functionality in the interface you always have methods which are declared and in the implementing class you have to define them. Right. Correct. So you have to define one method called as call and it will it will have two parameters. First is string parameter second is map of string comma object parameter. So these are these three things you always have to remember. The first one is the interface name second one is the method name and third one is the bot parameters that we that this method supports. Right. Okay. And and I will also tell you why this has have been designed like this. So basically now what will happen I will call my apex class from the remote action and this is my method name. So basically what will happen. So as soon as this is my remote action configuration you just give me the remote action class name give me the remote action method name. So now what will happen this test example will automatically get passed to this string parameter. Right. Okay. And in the in this method what we can do we can just check method name is equals to test example then we can create our own method and let's say if I have multiple methods for example if test example one so I can call some other method. Right. So this is how I mean like what you can say is whenever we create let's say some sort of utility class in Salesforce. So in a single class we define multiple methods for multiple functionalities. So it's kind of the same. Whenever we are working in on only studio in a real time project we never create a new apex class for every remote action. We always create a one remote class only and we create multiple methods in it. Right. Okay. And now we talk we will talk about this input. So basically if you remember these options from the data actor IP calling data actor to calling data actor from an IP these these are some options where we can send some input like we can for sending some inputs we can use San Jason path we can use additional input. So let's say I'm going to use the additional input and I'm going to use name let's say here I'm going to say SGTS. So in this like which which is used frequently this response Jason path or no thing or this additional input thing. So it depends actually so let's say if you have your all data into a single list they can then you can use the San Jason path. But if you have your data into multiple list then you generally we use additional input because here we can fetch the data from multiple list. Okay. Another thing is when you want to perform some sort of calculation before sending the data then in that case also we use additional input. Right. Okay. So now what I have done is I have just called my apex class and from the additional input I have passed one parameter which is name. Okay. And now if I go to preview and click execute and let me go back and go to the apex class I'll open the debug logs. So what I have done here is from this method I have called this test example and whatever I'm receiving an input I have passed it and first of all I have added one debug which is data. So this is whatever I'm receiving an input we are just debugging it. Okay. Right. So if I go here and paste it over here so line number 11 line number on line number 11 we have as you can see we have everything conditional block one null. I mean like whatever data we have into the IP we are receiving everything contacts and the reason why we are receiving is if I go back here I haven't checked this checkbox send only additional input. So whatever whatever things that have been executed into this IP tell now will be send it along with this additional input as soon as I click on this one send only additional input and if I go to preview again and click execute and there will be new data. So on the line number 11 as you can see in the data node we are receiving three things first is input second is option third is output. Right. Correct. And in the input node I'm receiving the data that I have passed from the IP which is name equals to as it is apex. Right. Correct. Yeah both key and values are available here. Correct. So basically this input will contain three nodes first is input second is options third is output. So input we have understood what will be coming into the input. Correct. Whatever we whatever we are passing as input will be coming in the in options what will come into the options. So in options what will be there I think there is one thing called set remote option remote options. So if I click here and let's say I'm going to pass one thing let's say test and let's say as it is test and if I click on preview execute again and another one data. Yep. In the options I'm receiving this test as it is one test. So what is the use of this option. Yeah. So now what will what actually happens here why we use the remote options to basically remote options send decent path and additional input are kind of same to send some some sort of input. So we have we have differentiated the send decent path and additional input. So the difference why we use remote options is like so let's say if you want to send some sort of settings I'm like it's not a let's say I'm going to say is call call account method. Okay. So this is also this is also some sort of this is also some sort of input but it's kind of a remote options like right that with the help of this input I can decide whether to call the account or not. So it's just a fundamental change. Yeah. Here we can pass only one one remote option only one key value pair. We can pass multiple. Okay. So there is I mean like if you go on a technical part there is no change into the remote options and additional input but if we see that fundamental part then we can decide. Okay. But we generally don't use the remote options in the real time college. Right. So if I go to go here and execute again I'm going to close this close this and in the data I'm receiving. Sorry. In the data I'm receiving the name as it is Apex. So we have understood input options and what is the output. So I will tell you. So I mean like this still until this line we have understood now from here what we are doing is I mean like if you want to fetch your inputs what how you can fetch it I mean like if you have worked upon the JSON part if you want to fetch some sort of key value pair from your JSON into the Apex you have to use the get method and into the get method you have to pass the input the key value. So your data is holding three key value pairs first is input options and output. So from the input you will receive your if I remove this and if you see the output of this one this debug log from the inputs now from the inputs you are only getting the input value inputs value not options not output. So this is this is how you can retrieve your inputs from your data. I mean like whatever input parameters that you are receiving now we understood the options as well you can use if you write here as options options will be available. Now the third variable is output. So basically the third node is used to pass some data from your Apex to your IP. So basically in the inputs and option you will receive the data from IP and in the output you will send the data back to your IP. So here what I'm doing is I have created one variable sorry one map which is of type string comma object and from here I mean like in this in this map I have set I have created one key value pair where name is equals to sjts from Apex and this output I am setting so basically this data dot put is used to put some value on your key value pair. So in this data on the output output key I am setting up the output variable that I have created so I'm like you if you don't get confused I'm like says like output one yeah so I mean in your data we had three key value pairs inputs options output and in the output we are sending the output one values and in your output one you can have anything right correct and now if I go back to my IP and if I see the output of the remote action I am receiving this node name sjts from Apex. So for receiving output we don't need to do any configuration it will be available in remote action one automatically correct yes if we have two remote actions it will be remote action one or remote action two correct yes okay so this is the another so this is the example of remote action actually okay so I mean like this the reason why we use Apex classes sometimes we are we will not be able to create a build some sort of functionality with the help of integration procedures so we pass the inputs from the IP from the IP to Apex in the Apex we do all the calculation and whatever we want to do and from the Apex we send the data back to the IP so I mean like I have I have explained the way of doing it now functionality can be anything scenario can be anything exactly correct so that is there yeah I think we can jump on to the next one the next one is the email action in IP okay so in the email action I am going to drag and drop the email action so this is very simple it's kind of the same when you want to send an email to the end user so basically in the email action configuration you can use the email template as well here you will be seeing all the list of email templates I don't think so I have anything yeah so what I'm going to see we have so many email templates these are the email templates which we configure as an admin right so I mean like right now I'm not I'm not going to use any email template so as soon as you deselect this use template it will ask you to email address list CCML email address list and BCC and you can set your email subject you can set your email body if you want to set your HTML that also you can do and you can set your org-wide email address content versions if you want to attach some content version files and this is your selected documents I mean there are some other options so we're going to use it I'm going to explain a very simple example so for example Sanjay if you can tell me any sort of your ID so that you can show to the user email ID yeah yeah so let me just so you can type sanjay gupta dot tech school at the read gmail.com so I'm gonna I'm gonna send email to this email address and let's say if you want to have multiple email address you can add comma and you can type in multiple as well and email subject let's say welcome on LZTS we're going to say hello world and if I go here and click on preview so I think Sanjay you must have received one email address because email because it shows me success equals to two yeah let me just say yeah I received an email so when you type in multiple email address you can add comma and you can type in multiple as well and email subject let's say welcome on LZTS we're gonna say hello world and if I go here and click on preview so I think Sanjay you must have received one email address because email because yeah I received an email so guys I won't be able to share that so if you want to experience it you need to implement and you will also receive an email yeah so very very basic example of using the email actions and this is this is this is what we use in real life as well I mean like apart from hard coding these values we get these values as a comma separated values from the DR and we pass it on a variable here that's it okay so that the data which we are receiving from the data rector we can pass it here also correct but it should be in the form of comma separated values yeah and if we that we can do with the help of formula okay and if we use the template then we don't need to type any subject or body that template we just need to use correct and you have to you can I mean it's similar similar thing that we do into the apex you have to set the what ID you have to set the email target object ID same things and what about two email addresses email template email template will give us the template only now how we can decide like to whom we are sending that email yeah so I mean like it I mean when we are using the email templates it would be decided by what ID right got it yep yeah so I think like people those who are watching they can explore this it is very simple config configurable action so in in flows also we use this in both the ways if you have template you can use that if you don't have templates so in flows we generally create text templates but here like we can type the body directly so I can recall it is similar to that it is similar to that yes so moving forward the chatter action in IP okay so so basically the chatter action what it does it's again similar to the flows it creates a chatter on to the record right simple so let's say subject ID I think in the subject ID you have to pass the record ID in the mentioned user ID you have to pass the user which to which user you want to mention in the image you can give some static resource ID and I think in the markup type you can set it is a bold metallic or underlying so these sort of things so let's do one thing I'm going to open one account okay what we can do here is from this data rep direction let's use this account ID okay the properties here will be the subject ID and I'm going to use my user only to chatter myself copy my user ID and let's say into the text I'm going to say hey and let I'm going to select the markup type as bold let's say and I'll go to preview and click execute and if I go to the chatter action okay there are a lot of things as coming as output but let's go into the record itself let me go to the account and I will I think this is the account not sure can I go to chatter yes it is there we can see the hay is coming in bold and my user have been notified right exactly correct yeah again they like viewers or learners needs to explore this right correct I mean like these are some some of the elements which is not frequently used so I mean like you can explore so many things around it like how we can do it and last but not least which is a delete action in IP okay so for delete action okay if I go here yeah so into the delete action we have to first of all we have this thing add as object to delete so in this as object you have to select the account the object records that you want to delete so I'm going to delete the account record records for example and what which records you want to delete so let's say yeah so whatever data I'm receiving from my contact records open this data reference that action so in this one path to ID I have to give the path so how we can do that so the result is coming in this one and if I go here sorry contacts okay I think we are not receiving the ID so I'm going to receive the IDs as well contacts I'm going to go here in the output I'm going to create one more mapping which will be like text colon ID and here also I have to mention ID okay and if I go to preview so first of all I'm going to go to that account and in the related list I'm able to see my contact now if I go here and click execute okay I think there is some issue delete action it says configuration error I think I'm not really sure but we have to use these as well okay the merge fields and execute no yeah now it is so such as false again okay configuration error so do we need to use that name data actor to what yeah I think so we have to use this okay oh see this is the error we want to delete the contacts but in the type we have selected the accounts we need to change the list then so if I go here contact so basically we are trying to delete the contact ID and on account object we are searching so it is not available exactly and now if I go to preview again and execute yeah now it didn't even error and success is true and if I refresh this account my contact is gone right so basically if we go again go to the configuration very simple you just give the object name and here will be the path so right now we have the single single record list if you have a list of records then that all that will also support this one okay and in this case this response transformations additional output doesn't make any sense yeah because it will not return anything yeah okay so I think you already explained all the scenarios so out of curiosity one question like if if anyhow we want to implement a looping scenario so is there any option for that also yeah we have the loop block through they want to implement it so I mean like I can execute this one so let's do so in this once first of all you have to pass the loop list on which list you want to loop okay for example let's I'm going to loop on this one colon I think it's coming into the not sure but yeah in this easy list so this is your list first of all okay right and now let's say you want to call your apex class so I'm gonna use this remote action in this one okay and let's I'm gonna click on execute and see this your remote action is getting called twice now okay one two and three so this is how you can do the loops but it is I think complicated yeah it is complicated but I mean like the basic fund of this one is like this one I mean like you just have to give the loop list and in that loop list or you can do whatever you want so basically let's say if if you want to call it after three times so one more question we are passing acc list and acc list having having three records three account records right so in remote action one so generally we implement for each loop and we create a variable also like account acc colon acc list so from acc list one by one record will come into acc variable so do we have that sort of thing here also or it will be yep okay we have so I mean like what okay what we'll do here is we will just simply pass the name okay so if I go I'm going to just say name so basically now okay let's just see into the action once then I'll explain so each account records name will be passing automatically exactly yes so in the input okay nothing is coming but it is called three times data is not coming but it is called yeah but I think okay we'll figure it out I think you have to use the loop lock one as soon as the mean I think because I also haven't used this loop lock much of it so yeah I think I have to check for this one and then I'm really not sure about this no problem so it is generally not used frequently yeah okay okay so I think you already covered all the scenarios so yep next next session we will be planning for omniscript and flex card so so guys we will be doing that session on Friday so so that all the like independent components will be demonstrated to you so data raptor we already covered IP we already covered whatever important actions you need to use right and in one of the session you will be learning how we can use omniscript and flex card along with IP and data raptor and then next week Abhishek will give you end-to-end implementation of a real-time project so we will discuss about the requirement first then we will explain you the technical solution of that requirement so requirement will be available in the layman terms right and then we will guide you like how its technical solution is being done and through that we will try to explain you like how exactly you can implement it in the Omnis Studio application right so if you follow all these videos I'm sure you will be able to understand or will be able to do all all the hands-on and Omnis Studio is demanding in the market so if you are working as a developer and you are struggling for a job so if you add Omnis Studio as a skill set in your CV so I think it will let you stand out from other folks okay so thank you Abhishek for spending time and I think we will be having two more sessions and then this season will be completed and then maybe we will plan something different other than Omnis Studio okay and there is one comment velocity open interface so earlier it is used to call this thing correct correct okay so someone like Krishna might be working on any project where they are still using this so in existing orgs like this is available in the new orgs so the thing is I mean like wherever in wherever we are just using only the Omnis Studio there will be the system dot callable interface will be there but let's say if you are using any sort of industry for example you are using the insurance cloud okay so you have to use that velocity open interface still okay yeah okay and I think okay yeah so this is it so I think we can wrap the session here on it and thank you for joining the session thank you Abhishek for sharing the knowledge see you in the next session