 Hello, everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So today I'm going to deliver day 55 session and today's session is basically based on curable epics, right? So this week, actually we are going through the features which are provided by SN Chronos Apex in that series. Today I'm going to explain you what is curable epics and how we basically use curable epics in Salesforce, right? So this is very interesting topic and I hope you have gone through the last two sessions which were based on future method and batch epics. So I gave you one task as well for both future method and batch epics and provided one reference video as well, right? So if you are watching this bootcamp video for the first time, so for your information, like if you want to follow all the videos which are related to this bootcamp, those are already happened. So this is the session tracker and in this session tracker, here you can see all the session links are available for past and future links you will be having here on the day of session, right? And the link of the session tracker is available in the description of the video. And alongside Salesforce, Sanjay Gupta Tech School is also hosting cybersecurity bootcamp. So in the adjacent tab, you will find session tracker for cybersecurity bootcamp. So here also you will find links of all the sessions, those are happening live. So you can follow that as well, right? And for Salesforce, we have an exercise sheet. So if you click on this link, Salesforce exercise sheet link, so here you will find the link and this sheet will be opened where you will be having all the sessions, right? So here you can see day number 55. So today we are going to discuss about QAPL Apex and here one exercise is available and that exercise is actually having a reference video as well. So first implement that after understanding the concept that I'm going to explain you and then you can implement this if you get stuck somewhere, you can watch this recorded video. So I hope this exercise sheet is helping you and you are learning Salesforce topics and features day by day in proper way, right? And if you are joining this session for the first time and if you want to follow the bootcamp and you want to know with whom you are interacting, who is your instructor? So just go through this slide and this slide is basically showing what I have done so far and I'm actually helping students, freshers and working professionals to ramp their career in Salesforce ecosystem. So actually we are following all these virtual learning best practices, so you need to focus on live sessions so that you can understand the topic properly. Take proper notes, write down the doubts and ask in Q&A session and don't miss any session. Everything is connected, practice and if you miss any session and if you have any doubts, so go through the recording and you can ask your question in the telegram group. And all relevant links are available in the description of this video. So keep doing above every day to build strong foundation for a successful career in ecosystem, in Salesforce ecosystem. And I can see on LinkedIn, there are various posts available like companies are hiring folks who are having at least one year of experience, right? So soon there will be lots of opportunities for freshers as well. But if you are switching from any other technology, so maybe like you can apply for those jobs because this bootcamp will give you six months of, like, internship experience, like you have done all the practice. So maybe you can just apply for those jobs and if you get selected, so it will be good for you and do consistent practice, right? Please do practice regularly so that you can strengthen your, like whatever Salesforce admin and development you are doing. So you will be master of all the topics. And if you need QR code for telegram group, so here it is. And like in each session, I'm explaining the topic and I'm giving the demo and I'm just answering your questions as well. So this is a unique kind of bootcamp where each and every session is happening live. No recorded videos. I'm just coming live every week, three or four days and explaining the topic doing demonstration. And answering each and every questions, whatever you have. So like utilize this bootcamp to strengthen your knowledge. And this is the past, present and future timeline of this bootcamp. So we have completed 14 weeks of this bootcamp. We are currently in week number 15 and tomorrow week number 15 will also be completed. Next week, you will be having sessions related to visual force and then we will be having sessions related to integration, right? So I hope this bootcamp is helping you and improving your knowledge day by day. And follow Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram and Telegram so that you can receive timely notification. And all the important links related to session tracker or exercise sheet. Those are available in the description of the video, right? So share this channel with lots of folks and my next bootcamp. So from June 1st week, I will be starting a bootcamp on C and C++ programming. That will be for students, freshers and non-tech guys or those who are having a gap in their career so that they can start learning programming. And after learning C and C++, you can jump to Apex programming. You will be easily understand the concepts of Apex programming if you join that C and C++ bootcamp. And one bootcamp will be based on a particular cloud. So I'm just thinking about Omni Studio. So I'm just planning to create some prerequisite videos for that. And then like me and my colleague, my teammate will be coming live and we'll be doing that session together in front of you. And we'll be answering all your queries, right? So coming to the topic, so we are going to discuss about Qable Apex. And if you have any sort of doubt, so just write your doubt in the chat. First, I will be explaining this concept. We'll be giving you a demo and then I will be taking all of your questions, right? So feel free to ask any type of question, whatever you have in your mind, and I will try to answer your question. Okay, so first of all, we need to understand about Qable Apex what it is. So those who have gone through the future method session. So in future method, I explained you like if you want to run any process in the background or you want to interact with any web service, web callouts. So for that purpose, basically we prefer future method. But future methods have some limitation. So those limitations can be overcome with the help of Qable Apex. So you can say Qable Apex is a superset of future method with extra features, right? So it is a combination of future method and batch Apex. So Qable Apex is basically combination of future methods and batch Apex. So this is important to remember. Now, in future method session, I told you future method basically works on primitive data types or collection of primitive types. But Qable Apex works beyond that, right? So if you want to pass as objects as an argument in the Qable Apex, so that is possible, right? And if you have implemented any Qable Apex, it can be called by a simple system dot enqueue job method and enqueue job return or job ID that can be monitored. So in yesterday's session, you saw like after implementing batch Apex, we need to call that batch Apex with execute batch method. So similarly, if you have implemented any Qable Apex, so it will be called through enqueue job, right? And it will also return an ID. So yesterday I showed you like batch Apex when you started execution. So it also returns an ID that you can monitor. So here also in Qable Apex, you can monitor that ID. So these are few points that you need to remember while working with Qable Apex. And here you can see we have three more benefits. So two I already discussed. First is non-primitive type. So non-primitive type means you can use S objects like other than primitive. So primitives are integer, string, decimal, double. So these are primitive data types. Now if you want to go beyond those primitive types, so non-primitive types are your S objects like custom object or standard object. So if you want to use them or collection of S objects, so those can be used in Qable Apex, right? And you can do monitoring as well in case of Qable Apex because you will be receiving the ID. So through that ID you can query and you can do monitoring. That is not possible with future method because in future method you won't be receiving any ID for monitoring purpose. And we have chaining jobs option available with Qable Apex. So now we need to understand what is the meaning of chaining of jobs. So suppose you have implemented a Qable Apex class where a method is available. So through that Qable Apex method, if you want to call any other Qable Apex method. So through one Qable Apex class method, if you want to call another Qable Apex class method, so that is basically known as chaining of jobs, right? And it can go in any depth. So from one you can call second, from second you can call third, from third you can call fourth. So this way you can apply chaining of jobs. But from one Qable Apex method you can call only one another Qable Apex method, right? So these features you need to remember and asynchronous Apex generally asked in the interviews. So you just need to remember what is future method, what are the characteristics of future method. You need to remember about batch Apex, then you need to remember about this Qable Apex as well, right? So I hope if you go through all the sessions Monday, Tuesday and today's and tomorrow's as well. So you will be having all the understanding like how these particular features of asynchronous Apex works. So now I'm going to compare this Qable Apex with future method. So here we have future method syntax. So you all know like future method if you are going to implement. So we need to use at the rate future. So here we will be receiving list of string. So string is a primitive data type. And here we are calling a method MySync method. So basically what is happening? This MySync method is defined separately. So if you want to execute this method separately as a synchronized method, so that is possible. But if you want to call it under any asynchronous method like future method, so that is also possible. So it depends on the requirement. Like if you want to run this MySync method synchronously, so you will be calling it directly. But if you want to run it as synchronously, so this MySync method is called inside my future method. And if you call this future method, so it will be running in the background and it will be creating a separate thread. And then it will be calling this MySync method, right? So through future method, you can call any other normal method as well. But that normal method in that case will be running in the background as synchronously, right? So this way, actually future method works. And now if we see the cueable syntax. So here you can see public, then class, then some class. So this is the name of the class. Then we have implements. This is a keyword and here we need to implement an interface. So interface name is cueable. It is predefined. So yesterday also while implementing batch epics, we implemented one interface. So similarly, while implementing any class and you want to convert that class into cueable epics. So you need to implement this cueable interface and it is predefined, right? Then inside this, you have to define only one method. So in previous slides, I told you cueable epics is combination of future method plus batch epics. So this implementation is similar to batch epics, but in batch epics, we have three methods. Start, execute and finish. And here we have only one method that is execute. And here we are receiving one parameter of cueable context. Whatever operation you want to perform, so that will be done under this execute method, right? And generally for web service call out, we can prefer this cueable epics. And if you want to pass S objects as a parameter, so in place of future method, you will be preferring this cueable epics, right? So now how changing of jobs are done. So here you can see we have a class first job, which is implementing cueable interface and it is having execute method. Then here you can see we are calling system.encu job and we are creating instance of second job. So this second job is a class similar to first job. We'll be having one more class that will be second job and that second job class we are actually calling here. So this way if you're implementing any cueable epics class, so you can create instance of another cueable epics class here under this system.encu job. So this is basically changing of the job. So whenever first job class execute method will be initiating its execution. So once all the logic is processed, then it will be calling the second job cueable epics automatically because of this statement. So here first job will be the parent class and the second job will be the child. So if first job execute method is starting its execution, then only second job will be executing. Okay, so I hope this way you are able to understand this changing of job. Now I'm going to implement one example in front of you so that you can understand like how cueable epics is implemented in sales. So jumping here moving to developer console. So basically here I'm going to implement an example in front of you. So creating new epics class naming it as update parent account. Okay, so what I'm going to do I'm going to create one cueable epics class where on account record I will be populating a parent account record. Right. So what does it mean? So I'm going to show you that. So this way I just implemented this cueable interface. Now what I'm going to do. So here if I go to accounts. So on each account record there is one field which is known as parent account. So I'm just going to modify it. So from here I'm just clicking on select fields to display. So what I did I just clicked on this gear icon from here I'm selecting this fields to display and from here I will be selecting parent account. So on each account record we have this field parent account that I'm going to choose clicking on save. So here you can see this parent account field is available. So right now for most of the accounts we don't have any parent account for most of the account. Here we have this parent account. So for Dickinson PLC we have parent account as Burlington textile. So what does it mean? If I open this Burlington textile account record. So here we have this button. So this is for hierarchy. If I click on this button so you can see the hierarchy. So here you can see Burlington textile corp of America. This is the parent account and here we have this as a child account. Okay. So it is similar to that like if you have suppose you have five companies. So those five companies if you are putting under one parent company. So let's say for example we have alphabet alphabet is the parent company of Google. So Google will be the child account record and its parent account record will be alphabet. Right. So similarly here we have this parent child relationship between account. Okay. So what I'm going to do through code I will be querying some account records and on that account records I will be populating parent account with the help of cueable apex. Right. So here I'm going to implement the code. So basically I'm going to declare two variables here. So first one is ACC list and second one is parent account ID. Right. So these are two variables for the class. So I'm declaring them declaring these two variables outside the method. So these two variables will be available for all the methods that I'm going to define inside this class. Now I'm going to create a constructor. So constructor basically works whenever we create instance of the class. So here I'm going to receive account records and account ID. Right. Now these are the variables which are related to this class. So generally for class variables we use this dot ACC list equals to account records. So whatever account records we will be receiving in this variable in the constructor variable. Those will be automatically assigned into this ACC list. And then we can write this dot parent account ID equals to ACC ID. Right. So this way what is happening whatever values we are passing under these two parameters. This is a constructor. This is a constructor. Right. And these are variables of class. Okay. These are private. So we can use these variables inside this class only in any method. Right. After this I'm going to define a method. So now I'm defining a method and that method will be for applying some operation. So here cueable context context. Right. So this is execute method that I am going to define. And this execute method I'm defining because we are implementing this interface that is cueable. Now here under this cueable sorry under this execute method we need to write the business logic. So I'm going to iterate a loop over here which will be iterating over account list. So account list is a private variable of the class which is generating value from this account records variable. Now this account list will be iterated and ACC dot parent ID equals to this variable parent account ID. So whatever value is available like ID of particular account record will be available in this parent account ID. So that will be populated under parent ID field of all the account records which are available into this ACC list. And after completion of this loop what I can do I can just write update ACC list. Okay. So this way I am just implementing this cueable apex and this cueable apex I will be calling from anonymous window. So I will be passing list of account and one account record that will be becoming parent account record for all the account records those will be available into this list. Right. So this list will be updated and all the accounts which are available in this list they will be having parent account as this ACC ID. Right. So this way I just implemented it. Now what I'm going to do I'm going to show you how it will be executed actually. Right. So for that I will be querying some account records. Those are already available in our system. So I'm just opening this anonymous window. So here I'm going to query account records. So first of all I'm creating list of account and I'm going to select ID from account where billing state equals to NY. So if I go here so we can see billing state is a field under account and wherever billing state is NY. So I'm just checking whether we have any record where billing state is NY. Yeah, we have this one. So we have one record where billing state is NY. So this account record will be updated and here we will be having the parent record and we will be querying that parent record as well. And we'll be passing that into that cueable epics so that that will be populated here automatically. Okay. So right now I'm just squaring all the account records where billing state is NY. Now I just need to query the parent account ID. So select ID from account where name equals to. So here we need to provide particular name. So what I'm going to do. So here we have this one one three zero four. This is this. This is an account record. So I'm passing its name and wherever this account record will be matching. So it's ID. I'm going to receive like this. So what will happen through this SQL lots of account record will be query because whenever we apply SQL so data will be returned as a list. So here I am passing the 0th index and at 0th index whatever account record is available. It's ID will be assigned into this parent ID. Right. So these are the account records which we are querying. Those will be updated and this is the account record which will become the parent account record fall for above accounts. Right. Now what I need to do I need to create instance of update parent account. So we created this class update parent account. So this class instance I'm creating update job new update account. So here what I need to do I need to pass two parameters. So first one is ACC list and second one is parent ID. Right. So this is my statement. So this is the class name. This is the instance and through new I'm just creating the instance and passing these two parameters ACC list and parent ID. So these two parameters will go to the constructor and here I'm just writing the steps like system dot enqueue job and then update job. So update job is basically this instance I created above. So I'm passing it. So through this statement system dot enqueue job through this statement are apex class that queueable apex class will be executing. Right. And in real time scenarios if you want to perform this operation so you can call it through trigger as well. So in any trigger like if you have this scenario you have the data so you just need to write these two statements and you need to pass the data and your queueable apex will start execution. And if you want to run it manually so you can use anonymous window and this way you can just fetch the data and you can pass them as a parameter and that queueable apex will be executing. Now before executing it I'm going to take you here and refreshing this page. So basically what is happening here. So we just need to search for apex jobs here. Right. And here you will find all the scheduled sorry all the asynchronous processes. You can monitor them here. So in yesterday's session I executed batch twice and then a day before yesterday I executed future method and today I will be executing queueable apex. So one entry will be available here. So now what I'm going to do I'm going to execute this for you so that you can understand how it will be working. So I'm just clicking on execute. Okay. So there is some mistake. Yeah. Spalling typo mistake. So it is nq q u e u e. Right. So just correct it if you are implementing along with me. So now again I'm executing it. It is executed now coming here and doing a refresh. So you will see one more entry here. Yeah. Here you can see queueable job type is queueable and date is three five third May and it is completed and here you can see everything. Okay. Now what I need to do moving here and refreshing the page. So now I need to check the account records where billing state is NY. So here I have only one record where billing state is NY. So I'm just crawling down and going to show you the results. So here you can see we have one record NY and here parent account is populated as 1304 because if you see here so I just queried the parent account whose name is 1304. So this way code is working fine and if I open this and if I click on the hierarchies button so you will see that hierarchy here. This is the parent and this is the child. Okay. If you have more accounts where billing state is NY all those will be updated automatically. So this way you can utilize queueable and queueable basically works on as objects as well. So this is the major difference between future method and queueable apex and another difference is like in future you won't be having chaining of jobs like one future cannot call another future method. But in case of queueable apex through one queueable apex method execute method you can call another queueable apex execute method so that you can just chain you can just create a chaining of the jobs. So if one queueable apex execute method executed so it can call another queueable apex execute method automatically. Right. So this is the benefit of chaining. Right. So I hope this way you understood how this queueable apex is working now what you can do you can practice it. So after this session you can practice you can go through the recording once again and start implementing this and there is one question available here that you need to implement. So what does this question says you need to create a queueable apex class that inserts the same contact record through cloning. So what you need to do you need to create one contact record and that same contact record you just need to clone again and again and that contact record will be inserted under each account record wherever industry equals to media. So what you need to do you need to implement your queueable apex in such a way like if you are receiving a list of account records so you will be assuming that that list of account record is having industry as media so you will be like adding one contact record under each account record whatever list you will be receiving. Right. So this way you need to implement and if you are not able to understand it properly so just go through this recording and after watching this recording you can just implement the code without taking any help. Right. So this way you will be able to understand it properly. Right. And the link of this exercise sheet is available in the description of this video so you can go through with that. Now I'm going to take questions which are available here. Okay. So Ravi Kanth is saying he is listening Lightning Aura component and LWC classes and he's impressed. Thank you. Praveen, can you explain in few words about Salesforce associate certification exam it's trending on LinkedIn. Is it about admin side or yeah it is about admin side and like for beginner this associate certification is and if you have not done admin certification then this can be your first certification but if you have already done admin certification then if you don't do associate certification that is also okay. Jenna is asking sir why did you write private for that two variables so basically those two variables I will be using inside the class. That's why I wrote private. If you don't write private so it they these variables will become public by default. Right. So that's why so you can just specify the type. Right. So next question is from Venkatesh he's asking can I call the synchronous class into asynchronous class into trigger yeah you can. Rahul is asking like before see the video predefined it would be awesome yeah so like it it would be beneficial so if you go through the video and then you start implementing then also it is okay so it depends on you how you want to understand the concepts. Right. So I hope this way this cueable apex implementation is also good with you and like I explained all three features future method day 53 batch apex day 54 and cueable apex day 55 tomorrow I will be explaining about scheduled apex and few other features so this asynchronous apex like apex related all the stuff will be completed by tomorrow then next week we'll be doing visual force and then we'll be doing integration right so this is all about today's session and if you have any more question you can ask I think this topic was straightforward so you won't be having much questions still if you have you can ask otherwise do practice and I would say don't mixed up cueable future and batch they are for different purposes so call them separately if you want to call a cueable apex from another cueable apex then you can go with that way and future we cannot call in through another future and batch is separate batch is for existing data so keep them separate right so yeah so Ritu is asking about LWC so next week will be visual force then next two weeks will be for integration and after that from next month I will be starting HTML CSS and JavaScript those I will be covering into one or two weeks and then I will be starting aura and then LWC so I'm going step by step so that you can understand the topics properly right so this is the plan and I won't be like completing the topics in rush so I'm explaining only one topic each day so that you can understand and you can do a regular practice so I think I already covered only a few things like platform event and custom metadata type these are remaining so I'm planning to do them tomorrow for them like I have material not prepared that's why I'm skipping them every week so we'll try to prepare some content over those two topics and then I will try to cover them otherwise next week for sure those will be completed yeah so when I will be starting DevOps like right now lots of bootcamp is planned so let me go step by step so DevOps will be there I'm planning so maybe in June and July you will hear lots of bootcamps will be there right so by the end of this year most of the things will be covered everything will be available under this common Excel sheet so here I will be adding more tabs so all the technical related sessions will be done so you will be having different different tabs where sessions will be there and anyone who is the beginner they can just click on particular tab and will be having everything planned right so this way I'm proceeding further and will try to make Sanjay Gupta Tech School as a platform where everything is available free of cost and then you can decide like whether to go for premium batches or not so I will be doing some premium batches like limited students and will be focusing on your like technical as well as your personality development classes so I am working on those as well so those will be having very limited amount and that will be for premium audience those who gone through all the free content still they want to have some focused sessions so for them those sessions will be available yeah so like OM is asking how many days will take LWC so OM you can just go through the session tracker session tracker will give you all the insights right so Chandan there is one playlist available so in that playlist total 25 videos are available on LWC so you can just go through with that I will be adding more videos into that so Venkatesh you're asking online or offline so I didn't get your question can you please ask it again great Chandan I am impressed and I appreciate your efforts like you are able to watch all the videos of that LWC playlist so it will be kind of prerequisite for LWC sessions so if you go through with that so you will be able to understand the sessions well so Rajiv advanced sales for certification means what yeah so Venkatesh right now I am planning for online but soon I will be opening offline center as well in Jaipur right so my first center will be opened in Jaipur only that will be offline and it will be kind of different campus where I will be having folks those will be going through the whole internship program for minimum six months and for maximum one year and I will be giving them internship as well as experience certificate certificate as well so that they can apply for jobs as an experience candidate so first step will be online and after that offline so I am working on that concept so soon like by the end of this year everything will be free I am planning on premium batches as well so first those will be launched as online and then offline will also be there so Chandan like 25 videos are already there so I have to create around 25 to 30 more so that is almost 60 percent of LWC 40-45 percent is still remaining okay guys so I think I covered almost everything for today see you tomorrow at same time and tomorrow this asynchronous apex and kind of apex will be completed so see you tomorrow thank you