 Hello everyone, I am Sanjay Gupta and I welcome you on Sanjay Gupta Tech School. So today we are having day four of this Salesforce Omni Studio Bootcamp and I have Abhishek with me so welcome Abhishek on the platform. So as you already know Abhishek delivered lots of content and today also like he will be covering data rector thing and in data rector we will be discussing about data rector export with multiple objects. So this is the agenda for today and I hope you have done the practice whatever we have discussed in yesterday's session. So do follow all the sessions so that you can understand Omni Studio well because it is demanding technology and it is very much important if you are willing to work with industry clouds. Okay so with this now moving on to the next slide I want Abhishek to introduce himself because I know like in every session there are new folks coming up so please let everybody know about your Abhishek over to you. Thank you Sanjay. So hi everyone I hope you all are doing well so myself Abhishek and I am working as a Salesforce and Velocity developer in Salesforce community and I have overall five plus years of experience and I am a trailhead double star ranger and I have done some certifications on Salesforce like Omni Studio developer CPQ specialist service cloud PD-1 administrator and I have worked upon several projects on Velocity or Omni Studio and I have done some projects on industries as well like health insurance telecommunication and industries club. Great so this is about Abhishek and quite impressive profile and he is already certified Omni Studio developer so that's why he is here and sharing all his insight so that you guys can learn things and get a chance to work on industry cloud. So with this moving on to the next slide so if you want to become part of Sanjay Gupta Tech School community so you can scan this QR code more than 3000 folks are already connected and they are learning they are helping each other so if you have any doubt you can ask and anyone who have already implemented that problem have the solution so they will surely help you out and if you want to receive timely notifications so on next slide like if you see Abhishek and we go to next slide so you can follow Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram and Telegram and the session tracker link and other important links are available in the video's description so you can just go through and check and please share a review or feedback about the bootcamp. So with this over to you Abhishek please start with the new things and it is the continuation of yesterday's session. Over to you. Sorry, I was talking on you. So we're gonna see in today's session a different type of data rector type which is data rector extract with the with the multiple objects so we have covered data rector turbo extract we have covered data rector extract but in data rector extract we just have covered only the part where we were fetching the data from only one object not multiple objects so in today's session we're gonna see how to fetch the data from multiple objects into a single data rector and that this is the functionality that data rector turbo extract do not support that is why they have given data rector extract where we can fetch the data data from single object as well as from the multiple objects right so for example if you want to fetch the data from from your accounts or let's say if you want to fetch the data from your contacts and if you want to get the get the related related account account records as well then this is the thing that you can do with the help of data rector extract where we will be extracting the multiple objects right and another benefit of using data rector extract for multiple objects is so that you don't have to multiple objects for the for fetching the for fetching the objects or records which are not linked to each other so for example let's say you want to fetch fetch the data from your account and if you want to fetch fetch the data from your let's say from any custom object right which is which is not related with your account object right then in that case we're gonna use the data rector extract where we will be where we can extract the data from from object which are not linked to each other right so I think Sanjay with this note we can jump on to the demo part right yeah Charlie and guys this would be interesting and complex as well because till now we worked with one object there was one list so here two different lists will be there different mappings so please focus on this session and do practice so that you can get your hands dirty and because after watching the session or watching the recording if you do implementation yourself then you can get enough confidence like you understood the things yeah go ahead Abhishek and start the demonstration I think we are going to implement first one right yeah exactly I mean where we will be fetching all the account information where active is equals to us and also as the first name ID of context where email ID is not equals to okay so accounts with related contacts yeah I mean first what we're gonna do is we're gonna fetch the account and context separately then after that we will be getting the we will be getting the context which is linked to the account only okay so this is how we're gonna demo it okay got it yep let me go to the org again I'm gonna company studio app and if I go to data raptors we'll be clicking the new and as we have seen yesterday for data record set the naming convention convention is DRE which is data record set where we will be seeing account with contacts the interface type will be the extract input and output type is json and in the description we can say batch call account records and it's and the contact records first step it's first step would be the similar to yesterday session we will be selecting our object which is your account output path will be account records and as we have in the slide right where name is equals to yes sorry active is equals to yeah okay we're gonna say active is equals to yes and for following the best practice what we're gonna do is we're gonna have a variable active param that we that we will be passing it from the when we'll be giving the input from the preview right and if I go to output so we want to fetch the account ID name and annual revenue so account account ID the value yesterday we want to give the parent node name is account so first mapping would be this second would be the name part and we want to say the account colon name and the third one is annual revenue right and now if I go to preview and if I click execute I will got I will get nothing because I have not passed the param value so I have to pass the param value as yes okay so I hope in this point everyone every understanding of how to fetch the records from the account right so here I can notice one thing for two account records and well revenue is not showing up so maybe that field is blank right exactly so on the account record for this this two account name United Oil and Abhishek this annual revenue field is not populated that is why it's coming as none right so so till this step we have covered in the yesterday session so now in today's session what we're gonna do is we're gonna get the context as well in in the same DR where we are where we are fetching the account records so for adding one more contact or one more object for retrieving the data we will be clicking another add extract step and in this extract step we're gonna select contact okay and similar to account what we're gonna do is give the name the give the name and in the condition we had where email is not equals to null okay so we're gonna keep it as blank when and if I go to preview and a click execute I will get nothing the reason is I haven't created any sort of mappings for the contact records so I have to go to output click the one more mapping and I have to say contact reasons so we're gonna get let's say contact result email and contact right and let's say if I'm gonna add one more field which can be your let's say contact first name contact first name right so now if you can see in the output json in the extract json path for the for fetching the account records we have referred the account records variable name and for fetching the contact records we have referred the contact result right but in the output json we have created two list first is of account second is of contacts right so now if I go to out preview and click execute so I will be getting two list first is of contact and second is of account right so as you can see we have fetched all the account records and the contact records in the in the single DR and at right inside we can see the s oql's yeah exactly in the s oql part as you can see first it data rector is executing the s oql for account object where it it has found the three records and for the context it has found the 22 records where email is not equals to null okay the the thing is this account and contacts right now are fed we are fetching these two objects independently there is no dependency we haven't defined anything like get me all the contacts for for for for all the accounts that we are fetching right now we are fetching all the contacts where email is not equals to null right so that's the beauty of data rector extract right if you want to fetch the objects independently then that you can do if you want to fetch the records where we where you will be having some dependency like for example I just want to get the contact records only for the accounts which is fetched from your step one I don't want all the contacts right so that also we can do in this data rector extract so for doing that what we can do is we will be just selecting this account records and here we're gonna we're gonna add one more filter criteria we were where we will we will say like on the contact the the relationship name or the field name for for the for the relationship on account is account ID right and over here we what we're gonna say is account records ID so from the first step we are fetching the account and we are getting the IDs of account in the second step we are fetching the contacts where email is not equals to null and account ID is equals to whatever we are getting in this account from the first step right and now if I go to preview and right now as you can see we have 13 contacts and if I click execute now we will be having only three contacts now and only only those contacts which are related to the accounts which we fetched yeah which we which we have fetched from the step one right and if you can see the as a quail as well so it says select account ID first name name ID email from contact where account ID is equals to this and email is not equals to null or account ID is equals to this so these account IDs are getting patched from your step one right so I mean when we are working with the apex right so if we want to get the contact records from the accounts that we have passed from the first so for that to write a loop you have to get all the account IDs in a set then you will be creating one more as a quail query on that set right but in the data that you haven't written a single line of code and it is giving you all the contact records related to the accounts that we are fetching in the first step yeah so this is this is one way of one way of doing all these things now let's say I am not fetching I'm not fetching the account records okay so maybe don't don't delete maybe we can create new data sure yeah so I'm gonna go and create a new data actor which will say give me all the contacts now with accounts okay so the difference between them is between them is in the preview as you can see in the contact list we just have the contact information in the account list we just have the account information right now what we're gonna do is we will be having the account information in the contact list only so that we don't have to we don't have to check manually whether this Tom contact refers to which account this list contact refers to which account we don't know we don't know yet right so what we're gonna do is over here we're gonna select the contact right and let's say contact records where email is not equals to null right and in the outputs what we're gonna do is let's say contact contact records email contact colon email and we're gonna add one more mapping for contact for let's say for getting the first name first name and now if if you guys are aware of as a quail query so when you are when you are querying the child child object so for fetching the fetching the parent object we use the APA name correct so for example if you want to fetch the data of account from the contact so what we what we're gonna write is select ID name comma account dot name comma account dot annual revenue right so this similar sort of thing you can do in the in the data reference right so for example I'm gonna fetch the account ID and let's say account ID and I'll create one more mapping where I'm gonna get the account name so what we're gonna do for that it would be content I mean when you are fetching the account from the contact you will be using the account for getting the account information account APA name for getting the account information and then you will be using the dot operator and now I'm gonna say name and in the result I'm gonna say like account name so you have to pay attention over here so what we are doing in this in this mapping is give me from the contact records I'm using the colon to get the account account parent relationship name then I'm using the dot so there are two things first I'm using the colon then I'm using the dot right so it's it's kind of similar to your SQL query where if you want to fetch if you want to get the parent field then you will be you will be using the dot operator right like if you do this account colon name then nothing will come like if I go to preview and click execute as you can see you are just having the account ID but if you want to get the any any sort of field from your parent record then you have to use dot operator yeah and I think this is very much important yeah exactly and now as you can see we have the account name as well so it is it is kind of similar to child to parent SQL and I can see SQL at right inside under debug law yeah it is exact same as we use the SQL query in child to parent relationship right one doubt I have like these are standard objects what if we have custom object so in in normal SQL we use underscore underscore r so is it same here or something different yeah it's the same thing I mean if you want to if you want to get I mean if you want to see one example we can do that as well okay so like if I go if I have any custom object I have one custom object test and I will go to field in relationships I have the account related to account so this is your custom field because this is not related to any sort of standard object yeah now if I go here you will be creating data after on test and I'll be creating yeah exactly so I'm gonna create one more data after so guys important thing now Abhishek is going to demo this multiple object thing on custom object so account will be standard and test will be custom right so yeah test is child object and which is having a lookup to account and through that test custom object we are going to fetch account information right so exact child to parent that is having custom relationship field actually right yeah I mean I can show you one more time so this is my test object and on this test object I have created look I have created a lookup to account right so for all the custom fields sales force added sales force will add underscore underscore C by default right now if I go back to the data after and if I click save and if I do get the data from your my test object let's say test results and I'm gonna say account ID is not equals to null okay so I want to get all the test object records where account ID is not equals to null okay I'll go to the output I'll create one mapping let's say I'm gonna get the test results or name test name and if I want to get the account name now so what we're gonna do is so in in a sequel if we if we are querying the parent field from the child object then we just append the underscore underscore C with the underscore underscore R right so that's the similar thing we gonna do over here as well account name and now if I go to preview and click execute so as you can see right now I don't have any sort of record so let me just go and create one record of a test object and I'm gonna select the count this account and I'm gonna click the save and if I go back to data after and click execute now as you can see we have the name of the test record and the account name from the test record okay yeah this is this is interesting like we don't need to learn new things same same SOQL concept is working here as well correct if I if I'll recap all these things so first we have we have created one data after where account and contact records we were fetching independently I mean then in the state after what we did is we just added one more filter criteria where give me all the contacts where account ID is coming from your first step first exact step okay and then we created a data after on the child child object which is contact and we got the information of the parent one parent parent records also like a company yeah and then child to parent on standard relationship exactly and then we created a child to parent relationship on the custom objects like this yeah so in in simple words we can say child to parent SOQL where relationship field is custom actually correct one yeah one question I have with with the first data actor so in this in this first rate data actor we are having two separate list one is account records one is contact result right so when so can we say it parent to child SOQL or no because in in debug log it is not like parent to child SOQL so account SOQL is executing separately and contact SOQL is executing separately I mean we cannot we cannot do these this sort of things for for getting the information from your data from parent to child okay yeah because we need to fetch parent first then only we can utilize those IDs to fetch the child records exactly okay yep so I think you you explained four different variations today that is great anything else that we need to cover in this section I mean if we go back to our slide and if you want me to give some I mean demo someone any another example we can I think second one is quite simple fetch accounts with related contact then fetch accounts with related opportunities cases fetch contacts with related account information that you already shown fetch accounts with contacts and context should have related account info as well so this this also you have covered and fetch account and contacts having specific record type so it this this I think we need to cover in the filter criteria right exactly I mean by this example I have got one more one more thing to explain so I mean I think we can we can demo this one I mean okay yeah please go back and if I go to the data rector I'm gonna say is like data rector fetch accounts with specific record type okay click save checking that I just need to go on the account object and let me check if I have any record type on the account so I don't have any record type I thought I'll create a new one quickly let me call it as as gts again make available for all the profiles if I go back to my data rector and so we're gonna follow the same step get the account records declare the variable name or the list name and we're gonna say active is equals to yes again I mean I'm using this variable name for filtering the data so that it becomes your practice otherwise otherwise we will always be using the hard-coded values that is why I'm not giving any hard-coded values in the demo as well now if I click and so now what we can so what we can do is just type record type right so for fetching the for fetching the account records for a specific record type or fetching the objects with the specific record type there are two things that we can do is first what we can do is we can use the hard-coded ID right equals and give the hard-coded ID and if I go here create the output mapping like I'm gonna just give get the name of account name colon name and now if I go to preview I have to give the param yes it execute so as you can see I don't have any record with the with this record type ID right so let me go to the accounts and create one record as GTS that type and save it I'll go to the data again and in the preview I'm going to click execute what type ID is equals to this wait a second I'll copy the correct component I think so okay let me do one thing I'm gonna say select ID from accounts and give me the record type ID as a record type ID so this is the record type ID I think is that I copied right as you can see you have to give the 15 character 18 I guess yeah sorry 18 my bad and now if I go to preview and click execute so again I got it this is happening because the active of this one is not yes okay now you can see we are having this record fetched with the record type ID right but there is a there is a problem with it I mean when you will be deploying this data after to your next environment which can be your QA environment which can be your SID environment or fraud environment then this record type ID will not be the same and as you have hard-coded this record type ID over here if you will deploy this data after to your next environment you always have to update this record type ID correct so this is your this is this is one way of doing it but this is not with the best practices so what we're gonna do is what we're gonna do is we gonna say so I mean if you want to fetch your account record with a specific record type and if you want to use the developer name of that record type right so you have to what you can do is you just remove the ID so okay let me do I'll show you the select ID from record type and if I click execute these are the four record types I'm getting right now and if I'm I'll give I'll take the developer name but this is a this is a field on your developer name on your record type so as you can see we have this as just as JTS okay and now if I go back to my data raptor so what I have to do is I have to type this developer name and in this I'm gonna say as GTS okay so and now if I go to preview and click execute I'm still getting the as just as JTS the record which we created from the as JTS record type so that thing that I wanted to explain you guys was the way we are fetching the information from I mean so I mean from your child to parent right like if I take the example of contact on account we said account or name similar way these sort of things we can use in your filter criteria as well right so what we have done is every every object has a record type ID field created on on that object by default with the Salesforce so from from so in that in that case account is your child and record type object is your parent right so what we have done is record type is your parent object so we have used the dot operator and for getting the parent object field we have said developer name and developer name should be equals to as it here so this this is this is one of the example for for where we are using the child to parent relationship not in the output tab only we can use and use it into the filter criteria right okay it was quite impressive so I mean in this example if Sanjay what do you think I mean do you have any sort of confusion no I think it is clear and straightforward and like developer name will be intact across the environments so guys use developer name instead of ID in case of record type because when we deploy record type from one environment to another so ID changes but developer name will be intact right and that should be enclosed in single quotes so yeah and to understand it more clearly just do it in your org this is what I can say yeah so there is one question from Amar so he's asking like in debug log it is showing record limit is 50,000 so he's asking what if we want to fetch more than 50,000 is there any way so I mean by default only studio gives the limit of only 50,000 we can we can increase it by raising the case with the sales force okay so I think Amar this answers your question so to increase the limit we need to raise the case then only it can be done right so I think this is it for today's session so yeah like Abhishek covered lots of scenarios and if you can show the slide again so people can take a screenshot for practice purpose and this weekend I will be creating a session like exercise sheet so there I will put all these examples day-wise that you can practice and Abhishek I think we have couple of more slides where a few more examples are available like formula and input parameter so maybe in our next session we can cover any anyone from those yeah okay so if you have any more question you can ask in the chat and just just want to highlight one comment from Richard and I'm very happy to hear this so he's saying whatever I am today is because of you two year two years ago I started watching your C++ playlist and as a mechanical engineer and now I made it to Deloitte in my final year so this this this makes me happy and in live chat this kind of comment or like testimonial I received for the first time so I'm really very happy like Richard because of my efforts like it changed your stream from mechanical to IT and you you got some interest in CSN IT branch being mechanical engineer so mechanical engineer is also having lots of opportunity but I'm sure like by watching those videos you got enough interest in this stream so that you were able to understand the concepts and now you will be part of Deloitte so I'm very happy and this is perfect example of consistency I think I can I can imagine like lots of efforts you might have done lots of practice you have done so this this will be like motivation for other folks as well those who are struggling to get a job so I really appreciate your efforts as well along with my videos because your efforts are very much important on internet lots of content is available but if you do a proper efforts in right direction so any anyone can get a job so thank you for appreciating the efforts and thank you Abhishek for explaining all the examples in such a way so that now following this stream live stream people will be able to implement and guys please implement all those questions so that you can understand the problems right so with this note we end today's session here only so once again thank you for joining this session those who are watching the recording thanks to you as well and special thanks to Abhishek so we'll be connecting next week with data rector one session and then we'll be starting IP okay so thank you everyone see you next week