 Hello, everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So, today we have one more session on Salesforce Omni Studio. And this session will be based on data raptor scenarios. So, last week we did one session, which was also based on data raptor scenarios. And for this one also, we will be doing the same topic, but totally focusing on the scenario implementation. And for explaining all the concepts, all the scenarios with you, I have Abhishek with me. So, welcome Abhishek on the channel. So, as you all know, like last year Abhishek explained all the concepts along with few scenarios. But then we decided like this year, let's do all the sessions together where we will be just focusing on the scenario implementation. Right? So, that's why it is season two. And if you follow all these sessions, so you will get to know like how different scenarios you can implement with the help of data raptor IP, Omni script and Flexcard. Right? So, with this, like I pass it on to Abhishek so that he can let you know about himself. And then we'll start the session. Over to you Abhishek. Yeah, thank you Sanjay. So, hi everyone, myself Abhishek and I'm working as a Salesforce Velocity Developer in this community since five plus years. And I have done some certifications around Velocity or Omni Studio, which is first of all Omni Studio Developer. I have some industry specific certifications as well like one is industry CPQ and other is a health coding developer, which is from Velocity. And I have done some few certification on Salesforce core as well. So, that's about me. Okay, so that is impressive profile and like I can see a couple of updates from last year. And I hope this year also you will do a few more certifications. Yeah. Okay. And if you want to become part of a community where Salesforce freshers and experienced professionals are connected so you can scan this QR code. It is a QR code for telegram group which you can join. And if you want to provide some feedback or any reviews about the bootcamp so you can share your thoughts in the comment section of the video. So with this like let's jump on to the scenarios now. So we have three scenarios one by one like Abhishek will be implementing them so that you can understand how these can be done with the help of data adapter. Yeah, sure. So today again we're going to implement some scenarios from data extract only. So first scenario that we have into our picture today is where we will be fetching again account records, but we will be doing some sort of ascending descending and limit as well. I mean like the exact number how many records we want to fetch. And then we will fetch the records from data extract which are related to each other in various various ways. So we will be playing around account and contact object which is related to each other, but we will be playing some we will be having some. I will I will implement this scenario in various ways so that we will be able to identify identify how to work with related records and from different requirement how to implement those requirements. Let me jump on to the this is the. So I think for these scenarios you will be creating new data actors yet. So our first scenario is fetch ID account name and annual revenue right account name revenue of five account records and sort it into the ascending order. So we'll go to the data actors we're going to create a fresh data actor or data extract and name it as let's say. So I think we can add sort word so that it will become. Yeah, so simply we want to add the extract step and which will be account. Here we're going to say accounts to the result output json part. And here we're going to use our where clause. So we don't have any where clause or what we're going to do here. I will say where name is not equals to null. Okay. And now we were saying we want to fetch five records. So for that we have this limit limit functionality into the data actor where we can say give me only five records. And another thing that we want to that we want to do is we want to fetch it into the ascending order right. So we're going to click on the order by and in the order why we have to specify first of all from I mean like from which field you want to order by this. So we're going to say name and it should be in ascending order. So that would be ASC. The way we write into the into our SQL you're going to write it into the in the same manner. So what this extract data extract will do it will fetch the account records where name is not equals to blank. And we will be getting only five records and those five records will be into the ascending order with the name field. So if I go to output and let's say I'm going to fetch the name and if I click on preview click execute. Yeah. We need to check name whether it is having ID. Yeah. The first time that we that was that was getting extracted. Yeah. Maybe I think we can check through list view. It will be. Yeah. Okay. But can we do the. You know I think we cannot do this right. No. No problem. This is the account that is getting fetched and the account name is edge communication. So that is fine. Then why we are having the collect me for some other field. So let's say this is giving me the correct output. And what if we fetch ID also. Yeah. So IDs are different from name. Something wrong with this. Yeah. So I think for few records maybe ID is populated in place of some name because it is in sequence. If you see one GV RW six AD seven AD five. So I think this ID is. They are in the name field. That's why it is coming like this. Okay. So if I let's do let's do this thing. If I order by this one with the active field. And now if I click on execute. So now it is. Yeah. But now the data from active is not coming. Yeah. This is some data problem I think so but what we're going to do we're going to execute this query into the developer console. Actually active is not having some value. Yeah. Okay. So what we're going to do let's we will reverse this order. We're going to have in the descending order and if I click on execute. Now this is coming me. Yes. Right. Right. I mean when we were ordering it by the name in the name field we were getting the ID. So that that is the issue with the detector because it's working with the active. So we can we can skip that part but now we can see when we are ordering the all the records with the active field. It is giving me just values first and after that it will give me the no value because we have we are we have added order by with the descending order. Right. Yeah. I think that that should be it for this scenario. The second scenario is fetch ID account name and annual revenue of accounts where active is equals to yes and also fetch first name ID of contacts where email not equals to none. And another thing which is added to this question or scenario is both will be fetched in separate lists and there is a hint also that it should be it should be parent to child query. Yeah. So again for that what we're going to do is we're going to create a clone. I mean we're going to create a new data actor. Let's say clean to child. And we can say contact and we already have account and the where clause that we want is active should be yes and. Yeah. For the account only active and for the contact we have the email. So here we're going to say active should be equals to. Yes. And we don't need this. We can remove. And another is we want to also fetch contacts to contact and we're going to contact. So here we can do two things. There can be two scenarios. First one is contact can be independent from the account list. So let's say I'm fetching the records from accounts and I'm also fetching the records from contact. But I'm not defining any sort of relationship. But if we think in real scenario that will never be the case because if we are if you're trying to solve any problem or a business use case we will always. Fetch the records which are related to each other. Right. Right. So for that what we what I'm going to write is I'm going to say account ID. Is equals to whatever accounts we are fetching from the above. Account first of all data actor will fetch the account and then data actor will fetch the contacts but it will fetch only. Contacts which are related to the accounts which we are fetching in the step one. Yeah. Right. Okay. And according to according to the question we have to add one more where close where we are saying email is not. No. Same thing we're going to say email is not equals to. Plan condo. And in a question it was saying that we should be able to fetch the account and contact records into the separate list. Right. So I'm going to go to the accounts and we already have few mappings for account. But. We want into the separate list so I'm going to say I'm going to add account colon before all of them. So that it will create a list for them. So for account there will be separate mapping and for contact there will be separate so that once we'll be receiving the output so separate headers will be there. Right. So right now if you can see account we are having into the account array. Right. And now according to question we want to fetch the contacts into a separate list. So we're going to say account ID. And into the account contacts list. And let's say I want to fetch one more field from conduct which would be the last name. The last name. And now we can see in the output json path we have two array list. First is account second is context. And if I go to preview and click on execute. We are having the contacts separately and we are having the accounts separately. Right. Right. This is what we we meant by the separate list into the scenario. But again, like as as we have discussed that if we are fetching the contacts which are related to each other right. Then if I go to preview and if I see this output I don't know. I mean like if I want to make this data more useful then what should be the case let's say if. Okay. Let me go to this account. And we have them. So in this account I have three contacts right. And which one is coming. No I think it was parent to the child. Yeah. So this is the Dick cruise one. So this is the one right. If I'm added one more contact and if I add the email ID that contact will also will be coming. So let's say save it. And again if I go and click execute I'm going to receive three contacts and save number of accounts. But now if we see this Edna Frank and this list decrease is from the same account. Right. And I mean like if I want to make it this this data more useful. So what I would be wanting is that all the accounts of sorry all the contacts from the United Oil and Gas Singapore should come under this node only. Because right now we if we want to show this data into the lecture in some sort of LWC structure. We will we will have to add one more logic where we will be you know comparing the account ID and the contact ID if you want to show it into a structured way. So this data is obviously useful because we are only getting the contact which are related to the accounts. But it's it's it can be we can make it make this data more refined. So for this one we have we have the third scenario. Third scenario is saying that we will be doing the same thing but it should be into the same list. Okay. So for that one first of all what we can do is so basically what we will do is whatever data we are fetching into fetching for the contacts. We're going to make the same mapping for the output. So we will not we will not have the separate list for the contact. Okay. If I go here contact sorry account. So now what will happen whatever data that we are receiving it is coming under only the account node. Right. And now if I click preview and click execute you can see we have this account here. We have this account again. We have account information along with the contact and yeah together. Correct. So it depends like whatever number of contacts we are having so that many time. Yeah. Accounts are being displayed. Correct. But there is a problem here if you can see. So if I go to query result I am able to fetch five account records and I think sorry this is there and three contact records. This was this is query time. Sorry. So we have the five account records and three contact records. If I go to result it has created 15 account records. Okay. Five into three. Correct. So basically the output that we wanted that all the contact records which are related to United Oil and Gas should come under this one only. So right now what it did whatever whatever contact records we are fetching. So let's say this Edna Frank this Edna Frank is added with all the account records. So if you see we got the five account records Edna Frank is added with all the accounts as it is this this this and this. Yeah. It is one one contact is added five times. Correct. Correct. So this is not our desired output. So what data after trick that we can use it to use here is we're going to use this. So what is whatever is the result path for our account right. We're going to add it to the contact result part like this. So now what will. Okay. I'll just execute first and then I'll tell you what trick data after it for incorporating this one. Here we were saying with the account ID. Now what we have done we have changed the extract output part. So we have to change into the extract JSON path as well for the contacts right. Only for the contacts. Only for the contacts. Yeah. Last one. If I go click execute. If I go here. Paste my data. So here what we are what is happening. Just a second. With this as it is account new to we didn't have anything. For this one we don't have anything. But but for the United Oil and Gas Singapore. We had to two records. First is this one and second is the decrease. Or and the third one is the Edna Frank. Correct. And with this Abhishek as it is one we again don't have anything. So what it did. I mean like. Whatever account. Whatever I mean like the contact which is related to the account. It is added with that one only. It is not getting multiplied. So. For that one. Now what is happening. Let me tell you that. And for if you want to make it more refined here. What you can do is. Into the output JSON path. You can say contact. So it will be creating one node as well right. We'll do one more thing. Now if you see we were getting five account records. And in the result also we are having the only the five account records. And with this United Oil and Gas Singapore. There is another array has been created for the contact which is a sub array. And in this in that one we have three records. Three contact records that we are fetching. So if you see. The first result was not at all useful. The second record what the second format was useful. But it the account was getting repeated three times. But here what we are doing account is coming for only the one time and contacts are getting into the. Into this account node as a sub node. So this this is more useful. So. What data raptor is doing here data raptor is saying. Whenever whenever we have added this. Extract output JSON path into the contact. Extract output JSON path. So what will happen let's say first account is coming which is. For example let's say as it is account new too. Then instantly it will go to the second step. Previously what was happening it was extracting all the account records first. Then it was going to the contact records. But now data raptor can see that in the result JSON path of contact there is a dependency of account. So what it will do it will first execute all the first account record then it will go to the contact. And it will fetch all the contact records related to the first account. And it will this cycle will execute until the account records have been completed. In the output JSON path what we are I mean like left part is very understood. I mean like it is very simple where we are saying whatever result JSON path that we had for the account. It is accounts for the contacts it is accounts colon contacts. So this is simple but here one trick even two tricks that we do first we didn't edit this contact colon after the account. So what it did if we were fetching the let's say related to one account we are having three contacts. So JSON node was getting created three times for that account. But as soon as we added this contact list or contact array in between the account. Then what it did it didn't create the three objects instead it created only one object for the account and created another object for the contact which is an array. So this is this is how data wrapper plays with related records. Right and this this can be called as parent to child query. Yeah. And we will be we will be having one more example for this one only where we will fetch the record from child to parent. Okay. So primarily we will be applying on contact through that we will fetch the accounts. Yeah. Account information like which which is related to that particular contact. Correct. So what I mean like for understanding this example it might be possible that you have to watch this part again and again because this is a bit confusing but you will get to understand when you practice it. Let's jump on to the last one where we will be saying it should be from child to parent. So here we will replace it. What you want to do is you want to do this one only and when we are going from child to parent you don't need to query the account records or the parent records. Right. Through child only we will be able to fetch the parent information. So I'm going to delete this filter and in the output I don't want this. Yeah. I think an extract tab also we need to do minor modification. It is accounts colon context. So I think we can do this context. Right. Yep. And this one. So I don't want this and I don't want this and here also we will be making this change. Yeah. Contact. And remove this. Let's say first of all I'm going to get the last name only. Sorry. This is account ID. Right. Yeah. Account ID is fine. Okay. I'm going to say it account ID only. Remove this. Last name. And what we are doing is we are fetching two fields. First is account ID and second is last name. So this contact was not related to any account. So I mean like it didn't give the account ID and this one is related to the account. But I mean like if we think according to the data model, this account ID is a direct field on the contact. Let's say I want to fetch some some account field with the help of child to parent query. So what we're going to do is for that one, we're going to use our relationship name. So when we write the query, when we are we when we want to fetch the account data from the contact, we usually do select ID, comma, account dot name, account dot active. So here also. Till this part, it is fine. Contact call an account ID. But if you want to move to some parent record field, I'm going to use the relationship name. And after that, I'm going to add the dot operator. So you have to give some a bit attention here. Till this part, we were using the colon. But if you want to fetch the field from the parent record, you will we will be using the basic rule which applies to SQL queries with the dot operator. And here we're going to say, let's say I want to fetch the active field. The API name of the parent one. And you want to see context or the contact colon. This is up to you whatever name you want to be insecure. So active may be not having any value. So that's why. Yeah. So what we're going to do is let's put. Yeah. Instead active, you can use name. Oh, okay. Sure. Because of this one, this is context, not contact. Now here we go. So we have the account name with the child, child, child object records. Yeah, I think it is similar to SOQL and the child to parent SOQL. Correct. I mean, whenever we are, whenever we are using the custom objects. So that would be like relationship name underscore underscore R. Okay. We need to use. Yeah. So that's all for. I think today's session. Yeah. Yeah, I think you already covered all the scenarios and like this number two and number three are a bit confusing. So guys just was the recording once again. If you have any problem. So if you go through once again, you will be having better understanding. Okay. So I think we are good for today. So thank you Abhishek for sharing your knowledge. So I think we need one more session for data after. And then we will be jumping onto the IP. No, I think data after two more sessions, two more session would be, but let's figure it out. Okay. So maybe next week we can complete the data rector part. And then after that, in fact, we can pick IP flex card and omiscripts. Yeah. And guys, we are planning to do some end to end project also. So they are all, all the components. We will show you how you can relate and implement. Okay. Keep on watching the series so that you, you can do some hands on with Omni studio and this skill is very much demanding in the market. So if you want to upskill your CV, so just practice Omni studio and have it in your CV so that you can impress the interviewer. Okay. Thank you. Thank you guys for joining the session. Thank you Abhishek for sharing your knowledge. See you in the next session. Bye everyone.