 Hello everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So today we are having day six of Salesforce Omni Studio Bootcamp. And today we are having this session little early. So I have Abhishek with me. Welcome Abhishek on the channel. So like today in this bootcamp series we are going to continue data rector. So one tool of data rector is pending one feature we can say that is load. So so far we have discussed like how to fetch the data right through a turbo extract and extract and through transform we we saw like how we can modify the data in terms of key value whatever you want to change you want to add or filter something right. But other than querying the data if you want to perform insert update these kind of operation. So these are like DML operations. So data rector load is equally important. Okay. So in today's session Abhishek will tell you theoretical concept related to data rector load along with that he will demo how we can insert data how we can update data and how we can absurd the data like both insert and update operation. But before starting the session I just want Abhishek to introduce himself because I know a few more folks may be joining the bootcamp for the first time. So Abhishek over to you. Yeah. Thank you. So hi everyone. I hope you all are doing well. So myself Abhishek and I'm working as a Salesforce and Velocity developer in Salesforce community since five plus years now and I am at double double star ranger on trailer and I have done two certifications on Salesforce which is as the first one is like Omni studio developer and other than Omni studio like CPQ specialist service cloud PD1 and administrator. And I have completed several projects on Velocity industries on and Omni studios like health insurance industries industry CPQ and telecommunication. Okay. This is something great. So moving forward if you want to become part of a community where lots of freshers and experienced professionals are connected so you can scan this QR code and you can become part of that group. Moving forward if you want to receive all the timely notification so you can follow Sanjay Gupta Tech School on YouTube linked in Instagram and Telegram and session tracker link is available in the videos description. So Abhishek next slide. So here you can see all the information is written and next slide. So we just hope like if you can share some reviews or feedback so that will be great. And one more update I want to give you like I just updated the session tracker. So now if you see the session tracker so there is a link which is which will redirect you to the exercise sheet. So I have prepared day wise Omni studio exercise sheet and whatever exercises or scenarios we were showing you in the slides. So those are available in our Word document now. Right. So in that Word document you will find day wise exercises and you can do some practice from there. So few examples Abhishek has already demoed in the session and few examples you need to do at your own. And if you face any challenge so you can raise your queries in the Telegram group. Okay. So with this note let's start learning data actor load. Yeah. So thank you Sanjay. So I'll just brief all of the concepts that we have seen so far on the data actor topic. So we have seen how to extract or how to fetch the data from your databases with the help of data actor turbo extract and extract and we have seen if you want to do some modification onto your data right as we have seen in the seen in the last session that if you are receiving some account information and if you want to change the key part or the value part of that Jason right then we can use transformations data after transformations. Another use case can be of data after transform if you want to trim down your data. So for example from your data actor extract you are having 20 account fields right but in your IP or omni script omni script you just want five pills for that account account record right. So what you can do is you can create an IP where you will be calling your data actor extract and from that data actor extract. Next you can call a data actor transform and in that data transfer transform you just trim your data down with those five fields. So this can be one of the example of data actor transform. So and in today's session we're going to see what is data actor load which is the last type of data actor. So whenever we are working with Salesforce right we do with in terms of databases we do some sort of operations like fetching data inserting data updating data or sometimes we upset also right. So for for doing all the data manipulation so I mean data at the turbo extract and extract was the SOQL query part where you are querying the data but if you want to perform some DML operation right database manipulation then you have to use the data actor load. So data data actor load is nothing but if you want to insert let's say for example if you want to insert some account records if you want to update some account records or if you want to absurd right so then in that case we can use data actor load okay. So let's go to the next slide and as we can see in the data actor load one of the example can be create an opportunity and using a formula to populate value into a custom field or create an opportunity on an existing account right. So these sort of examples we're going to see in the action today. So if I go to the next slide then we have some more examples of data actor load and we will be seeing one or two examples in today's session in a practical way. So for example like insert an account record insert insert bulk account records we can also update it or we can also absurd absurd the account records. So as I can see Sanjay you have added some. Yeah so basically I just align this slide with India Trikala and I just just want to dedicate it to Chandrayaan 3 because it is on moon now. So when I was creating this slide Abhishek so I just added that peach color or like first one to insert and then I realized like to have that trikala because we have four example for insert four for update four for absurd. So it was going in that way. So I just had a thought and just applied. Yeah and yeah proud to be an Indian. So yeah so sharing this knowledge across the globe. So I hope people from different countries are able to recognize us and our work as well. So they should be proud like Indians are doing lots of things. Yeah I mean that's a great concept Sanjay. I mean if this stream or this recording on YouTube if anyone is watching outside India who is not from India then they will be aware of like we are we are on moon now and it's a great and proud moment for India. So we will we will go to go to our org now and we will see all the data actors in action data at the moon. So I will launch Omni studio. We will go to Omni studio data actor on here and so first time I'm just picking one example of inserting inserting an account. Okay so I'll click new and for data actor load. So there is a catch while you are creating the data actor loads the name of this this data type of this name type of this data actor is called as load but when you are creating the data actor load right it is called as data actor post right. So I mean whatever data actors you are creating you will be using those data actors into the IP or Omni scripts right. So when you are when you will be using this data actors into your IP so this data actor load comes as a data actor post action into the IP or Omni script. So the interface type name is load but we usually call it as data actor post into the industry where we are working right. So don't get confused with data actor post and data actor load these both of the things are same. Okay so we will call it DRP and let's say insert account records okay and over here we can we can give the batch size as well as we do as we do as we can do in the apex as well and interface type is load and input type is JSON and output here you can see output type is S object right. So and in the previous examples of data actor extract and data actor turbo extract or transform the output type was also JSON but why there is output type is S object because if you want to insert or update or absurd any sort of records into your Salesforce domain that can be only S object type there is no nothing else not no JSON no XML or no any custom data you can insert it into the S object only that is why we have only one option called as S object right I will click on save now we will first see all the tabs we all the tabs we have in the data actor load so first tab is data objects tab so in data actor extract we had the first tab as extract step where you used to select the object name and what filter criteria or where clause you want to apply right it is similar to the data actor extract in the first step you will be selecting the object which object records you want to insert right so these these objects can be multiple in the in the first step now if you go to the next step which is formula which is similar to data actor extract turbo extract and transform and in the field step we will be creating the mappings with the S object fields so for example I want to insert an account with the name with the name field gets populated right so we will be creating all the mappings in the field step right if I want to populate email on the account that also we will be creating a mapping in the field step now if I go to options there are few options like ignore errors rollback on error use assignment rule override target for null inputs right so all all these things are self-explanatory but I can explain it once again so ignore error so let's say any sort of error is coming so for example you are using this data actor into some IP or omniscript and this data actor is getting failed in that case that IP will give you the error but when if you have clicked this checkbox right then this then that IP will not give you any any sort of error because it will this is this is kind of a try catch so whenever a error is coming there will be no error like at the at the runtime if you if you if you will not check this checkbox right then if this data actor is getting failed then it's a bad user experience that user is seeing that that some error is coming that is why we have this checkbox rollback rollback on error means let's say if you are inserting 100 records then on the 99th record there is some error came so we want to roll back all the changes then we can check this checkbox use assignment rules if you have created some sort of assignment rules on the object then you can check this this checkbox and override target for null inputs so for example if we yeah if you are receiving let's say in the name in the name field you are you are inserting an account record in the in the name field you are having no value right then it will override the target for all null values that means that name field will not give you any sort of error when you are receiving the null value okay and if I go to preview tab it's same from here we will be giving the test input by clicking execute we will be get we will be getting the output now we're going to see how to insert an account record in action yeah so maybe first we can add or we can create one account record and then we can just simply create bulk records so that both the examples can be demoed yeah definitely no let me just close it once yeah now if I click on ad object you will just simply say sorry I want to insert the account record okay so for now we will not do not do anything in the formula step and now if I go to fields right so as you can see there is one sub tab already created with the account account object so whenever you are adding any sort of any any object in the objects tab for for the same there will be a sub tab created under under the field okay now if I click plus icon and let's say I will receive my account name into the name param okay and what we're going to say is map it with the name field we will see all these options later on but first we will go with a simple example and this name param from where we will be getting we will be getting it from here okay so we're gonna say let's say name sorry it should be name param and as just as gts account okay and if I click execute as you can see there is one account has been inserted and there is one more benefit of using this data rector load in the output you will get all the record IDs which is getting affected with this with this data rector okay so right now we have inserted only one account so we are receiving one account one account information or the one account record ID and if I click on this it will redirect redirect to me with to me on that account record so as you can see this name field has been already populated and other fields are blank right yep I think this was very simple correct now what we're gonna do is um so we will be seeing some abhishek maybe if we can focus more on that fields option once again yeah yeah I was about to go on there yeah so here this domain object field is very much important because I think it is api of that particular field with which we want to map the input parameter correct so for example I am gonna insert one more account which uh let's say I want to populate the active as well okay so if you see the domain object fields you will be receiving all the fields that you have created on your account right then so now what I want to do is I just want to populate one more field which is called as active so I'm gonna say active name and from where we will be getting this active name from the again the preview and input parameters but now let's say now we will see what these other things are on the on the field mappings so output data it is similar to data rector extract and uh data rector extract if let's say let's say your active name is it is in the form of string but your but your domain name field is a boolean right so then we can set the default output part which can be boolean currency currency round date and all these things and for example let's say if nothing is coming in the active name from the data rector test parameter then we can give a default value it is pretty much similar as data rector extract right is disabled is uh self-explanatory if I want to disable this mapping and now here we have three things um absurd key is required for absurd and is lookup okay so if I check this checkbox right then it will say whenever I'm inserting this account record right it will absurd uh it will it will not insert it will absurd so so what what do I mean by that wherever okay so that's a bad example for using the absurd key I'm gonna go to the name again so let's say I want to I want to insert or update my account record so for example if I executed executed once again right then there will be another account record of sgts account will get created right but if I go to name and if I click this checkbox then there will be no new account record will get created with the same name okay because whenever this data rector will get executed it will first check whether do I have one one account record with sgts account name or not if I have one record then it will simply update it if I do not have then it will insert it okay okay and if I check this checkbox is required for absurd then I mean then this field will will always be required I mean uh if I'm making any sort of any any mapping as absurd okay I'll go to active again and if I do this and if I if I'm not doing if I'm not checking this checkbox then if I'm not passing an active name then this data rector will not get failed but if I'm checking this checkbox okay um I don't know there is some UI so we'll take the name example only so if I'm not for example if I'm not passing the name param then this data rector will get failed so this checkbox says if you want to if you if you want to use this mapping as a as a absurd key and if you if you want to make it required for absurd then you can check this checkbox so in that case uh in jason name param should be having some value for exactly other yeah if we will not be having the value then this will get failed right and this lookup we will we will come come on this on this option later on because this will be a uh uh bit uh complex logic around it so we will come later on it later on it now if I and this transform map values is the same as data rector extract like uh if I'm receiving let's say if I'm receiving uh I'll I'll do this uh if I'm receiving as a input for active name as a input I'm receiving and why then I want to insert yes and if I'm receiving and then I want to insert no now if I go to preview okay so first what I'm gonna do is I don't have this name as a absurd key right I'll go to uh preview and I'll add one more mapping here which will say and I'm gonna say why so your account record suppose yes and no value but I'm passing the why and any value and all the all the transformations will done will be done from here if you are entering why then it will become yes if you are entering and then it will become no and one more thing like if if we are passing yes then what will happen then nothing will happen I mean it will be as yeah it will be as assigned only in case of why and and it will be transformed otherwise whatever we have provided there as active value it will go to the record no in that case there will be null value will be good because there is no mapping for yes okay so from input if we are passing why es so yeah that won't be stored null will be there won't be stored okay okay okay because we don't we have created a transform map values and we don't have mapping for yes we have mapping only for why so if we pass why and then yes or no will be stored otherwise null will be stored null will be stored correct okay got it so I will go here and we'll hit the execute let's say sjts account new and I'm gonna click execute and if I go to this account as you can say we have this sjts account new and if I go to active view actually that is active name you yeah yeah in that is what yeah so correct so what I'm gonna do is I'm gonna create one more account and so naming guys naming convention is very much important so always make sure because it happens it is a common mistake that we do so always try to copy whatever you have created right now if I go back here and like account name is sjts account new one and the active is set right now it is working fine now we will see the example of absurd so what we what I'm gonna do is I will click on this and I'll make this name feel as absurd key okay so now what will happen and I'm gonna change the why to end okay so in that case there should be no new account should get created but this sjts account new one should get updated so active should be no correct and if I go to execute and I will not click this one right now I'll go to the account record which is which is already open for me and I'm gonna refresh this page and if I refresh it go to details as you can check the active is updated with the no value right and for for just verification purpose if I go to account list view and you can see there is only one account with the sjts account new one right correct so in that case what happened we created this name param as a absurd key so so first data rector data rector goes into the database and sees whether we do whether we have account with the same name or not if we have then it will insert then it will update otherwise it will insert so I mean I mean like if I do this sjts account new two then in that case it will it will insert it let me just see we have any awesome and there is one more thing to catch over here in the in the case of absurd whenever we have made some sort any any any any mapping as a absurd key in the debug logs you can see there is a this data rector is running a query for patching the existing account right like if I execute it again it will say I have got one record yeah that's why that's why this id is populated here like this particular object is created okay like if I if I do not make this as absurd key right then it won't it will not execute any sort of as a girl can see it because this data rector is not looking into into the database now okay for upsetting the records okay so it is directly inserting in case of absurd it is checking that's why it is wearing the data okay exactly right now if I go back to the ppt so we have seen the insert an account record and update an account record and absurd an account record we have seen okay we haven't checked the update the update account record we have seen the insert and absurd right so now I will clone this data rector and we will create it update update case sorry you will call it as update and now I like if I go to fields and yeah so what we're gonna do is for updating it we're gonna we're gonna give one more mapping called as let's say id param we have to pass the id because without id you cannot update any sort of record if you are not using the absurd key feature right I'm gonna do this go to preview what did I see id param if I go to any account record let's say go to this as it is account you do update the id go back on the data rector and I'm gonna pass the id okay and I'll see make it as one right click execute now in that case data rector will not data rector will not execute any sort of as a SQL query to look into the database because we have passed the id as a mapping right and if I go to the record as well right it will the no value becomes yes so this this is this is one of the example for getting the id for for updating any sort of records so for update we need to use id yeah I mean without without id you cannot update the records yeah still you can use the absurd key because I mean whenever you are updating any sort of records we always try to use the absurd keys because this is not a good practice to pass a id field as a param right now we're gonna see one more another example where we will okay I'll go back to the slides where we will see create a account record with its related contact so I mean for for seeing for seeing this example what can be one of the what can be one of the difficulty that I can think of is let's say you are inserting an account record now you are inserting a contact record but how you will link the contact record with the account record right so we're gonna see how in the data rector load we can do this part for linking the objects linking the objects as well and before jumping to that if I ask one question like for bulk insertion data rector will be same we just need to modify the j sound right yeah exactly in I mean over here what you have to do is you will be I think creating a you can see that example as well yeah that's why I just want to have this first yeah okay so we have this then we want to have one more I mean now what is happening is we have an account account list where this is this is your first record if I copy this yeah inside this we can have one more comma separated and we can have any number of records here any number any number of records so what I'm gonna do is I'm gonna just remove this ID param because for new accounts we will not be having any sort of ID so we have sgts new let's say bulk and bulk 2 and what we're gonna do is in the field mapping I'm just gonna disable it for the ID mapping and I'll go to preview and if I click execute oh I think there is some so what happened now now what we have is we have all the records all the all the params into the account node account colon name param account column name active param so we have to add this node also into our input parameter so it should be account colon active param something like that that is why that data after being executed and this one if I go to preview again and click execute as we can see we now we have two account records perfect right this is how you can like if I go to account list view and refresh it we have this uh account bulk to account bulk one right and similar to insert like we can do update absurd uh that was same like whatever we did for one record it will be same for bulk so I think we can leave it for practice so yeah now we can demo the related thing correct okay I'm gonna go so what example we're gonna see now is uh if I want to insert a account record and in the same data if I'm inserting the contact record so how we can link those records I mean how we can populate account ID on the contact record so let's create a new data after drp insert one insert account with contact so before moving to that abhishek we have one question related to update so someone is asking for update we require id param so instead of exposing id is there any way to get into it in our data rector like instead of hard coding it so when we implemented update data rector so in that update data rector we provided id in json right so harsh is asking is there any way like we can without exposing that id we can get that id yeah there is a there is a way of doing it so let me go let me go there and just forget this rector for now I'm gonna go back to let's say update account and I think in real time it will be coming from ip yeah in real time the id will be coming from the ip but it's good that harsh has asked this question because I forgot to when I forgot to explain this is look up then okay okay what we cannot do is when I click this is look up okay as you can see there are four three new fields are coming right so what what it will do is I'm gonna use this account colon name param so you can think of it like this in this mapping we will be having we will be having this one sjs account new bulk one right we will be having this value correct and we have we have clicked this is look up now it will ask what object you want to look so we will say account object we will say account object what field you want to look so what we are passing in the name param the record name so I'm gonna say name field right and what value you want to get it from that query is id I'll reiterate this so in your name param you will be receiving your account name record name right now you are not passing the id id value or now you don't want to expose your id into your input parameter right but you still want to get that id so you will be having your name name parameter you will click this is look up and you will say what object you want to look what field you want to look in and after you are getting that record what field you want to get so you can think think of it this one like this select id from account where name is equals to this name param right exactly understandable correct yep and whatever whatever field you are getting from this this field will get mapped with your domain name of domain object field okay right so by this what you have done is you have not exposed your id into your data after input parameter but still you are getting the id and you are inserting inserting you are updating your records okay so you mean to say in json if we don't pass id and that value still that will be internally having the id correct we just need to create this mapping only right so now if I go to preview right and if I change this one to n for both of the accounts okay they will update they will get updated and as you can see into your debug logs it says select name id from account where name is equals to sgks account new bulk one or new bulk two right and now if I go to the account records so this bulk two it will be having no yeah no value right yeah so this is how it this is how it works so now I am not passing any sort of id if the id value into into my parameters but still I am getting my id from this sort of mapping so if we do this so it is for both insert as well as update right it's it's kind of a absurd absurd yeah so we have two options for absurd one is this absurd key and another is this is lookup correct right okay so I mean this this is lookup is a bit tricky but once you will be having the practical practical like around it that will be very easy now we will see the last I mean now we will see the insert account with contact records so we will do the similar thing we will select the account and I'll go to the fields I'll create one mapping for it let's say I will give the name param and I'll map it with the name okay in the objects again I'll go to the add object and I'll say contact because I want to insert contact as well and if I go to fields see there is all there is one septab created for contact and as far as I remember for contact last name is required field yes so I'm going to say last name param and I'll map it with last name okay now if I go to preview and I have to pass both the thing last name param let's call it as puncture and another term is we will say name param this is for account name okay so one account record and one contact record and both both will be related right right now these both will not be related oh but we will do something so that so now if I click execute I have got my account I have got my contact but if I go to this contact right I don't have any account populated right so both are independent yeah both are independent now the question arises when I'm when I'm creating the mapping for this account record and when I'm creating the mapping for this contact record let's say I can I can create a mapping for account ID but what to pass into input jizz because I don't whatever record which is which is getting inserted over here I don't have idea of that account so right so what we can do is so there is a there is a feature that data after load provides if I go to objects there is a there is one more button which is called as add link okay and if I click click on this add link so it will ask what domain field you want to populate I will say account ID what linked object you want to pass so as you can see in the first step I have account one hyphen account I will see this right and what field of this account you want to pass I will say ID so whenever account will get created from this account from this first step and when the second step will get executed it will automatically map this inserted account value to this contact account ID okay and let's go to the fields and the contacts see there is only one yeah mapping created by the data clock perfect right and if you go to that mapping so one checkbox is there is linked automatically yeah okay this is there and now if I go to preview and click execute and if I open the contact see here this account is getting complete yeah so this account and contact now linked with each other perfect okay so let me go to slides again yeah I think we covered almost everything yeah yeah so I think other examples folks can perform by their end and if they have any sort of doubt they can reach out to us yep guys so total 12 examples are there and I think more than 50 percent Abhishek already demoed other way around right so you just need to watch this recording once again maybe if you have any doubt any kind of doubt in any of the example and just try to implement each of the example one by one right in any order so you can first insert an account then you can update an account or absurd an account or maybe insert an account then you can just insert bulk account record so either way you can go but do practice and this is end of data raptor sessions so for omni studio as of now we have completed one tool now from next week onwards we will be jumping onto the another tool so right now what we were doing we were providing some inputs from our end into data raptor but now the data raptors which we have created we'll try to use those data raptor with ip and you will see input will be coming from ip and then data raptor will be doing some operation like fetching data or updating something updating some record inserting some record and then that i think abhishek that result we can pass back to ip again right yeah so ip can provide some input and ip can receive output as well through data raptor yeah yep and those sessions you will only understand if you complete all these six sessions whichever delivered so far okay so with this note we take your leave thank you abhishek for delivering the content and thank you everyone those who joined live and those who are watching the recording thank you too as well you as well and please find this exercise sheet link in the session tracker so that it will be easy for you to follow all the sessions or recording as well as exercises are available there so do practice and if you have any problems just reach out to our telegram group okay thank you everyone see you next week