 Hello. Hi everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So this is Monday and we have day number 53 today. And today I'm going to start a new session for you and this the topic of the session is as in Kronos Apex. So in this week, all the topics which we are going to discuss, those are related to as in Kronos Apex. And in today's session, I'm going to cover future method. Right. So one more time, welcome everybody, those who have joined and those who will be watching the recording. Welcome to them as well. So I can see Vida, Ajay, Naina, Feroz, Jayashree, Anuj. So hi everybody. Welcome to the channel. And I'm just waiting for more folks to join. And then we'll be starting the session with full energy. And I hope you've gone through the test classes sessions. If you have not attended those sessions live, and you got plenty of time last week to practice. So I hope you are doing lots and lots practice so that you can understand the concepts. Right. So moving forward. So those who are watching this video for the first time. So please go through this slide. It will tell everything about myself, what I'm doing, what I have done and why I'm conducting this bootcamp. So actually, I'm helping students, freshers and professionals to ramp their career in Salesforce ecosystem. So that's why I decided after creating lots of recorded videos, let's do live session throughout this year. So admin flow, these two are done. Apex is almost done. And now we are on as synchronous Apex. So this week, everything related to Apex will be completed. And next week we'll be doing visual force. Okay. So those who joined late, like by two, three minutes. So welcome them as well. Now let's discuss these virtual learning best practices. So these are important. So today, like I post one, one post on LinkedIn, which says like I completed 52 sessions live and free on YouTube and 50 more will be going on. So I think whenever we do anything, so we need to do things with proper focus, right? So I'm doing that with proper focus. And I'm assuming like you are also learning with proper focus. You like I am not sharing you the slides for notes. So you need to take notes for future reference. You can ask doubts. You can watch the recordings if you miss any session. Then number five is important like practice each session. So I just want to show you this session tracker. So many folks basically are not able to find this session tracker. So this is a complete session tracker where all the bootcamp related things are available, like all the session recordings you can find over here. And if you want to get the link of this session tracker, so it is available in the description of the video. And here you can see we have Salesforce exercise sheet link, right, which is highlighted here. So if you click on this link, so here you will find day wise exercises. If I take you here, so you can see number 53 exercises available here. You will see lots and lots exercises that you can practice, right? So these two documents are very much important as if you are following all the sessions of this bootcamp, right? Now moving forward. So keep doing everything on daily basis so you can understand things and consistency is the key. So I already told you 52 sessions are done. Every week I conducted maybe two, three or four sessions, right? And I know everybody who are following these sessions, they are learning as well. So consistency is the key. So please do regular practice so that you can understand the concepts and whenever there will be openings like lots of openings in the market, so you will be utilizing this knowledge. So you can see the practical example like we never knew like there will be a free certification voucher available that will be viral, but it was there, right? So those who started their Salesforce journey with me in January and in April, they found that free voucher and with the help of that free voucher, they are now able to give their first certification that is associate certification, right? So opportunity can come anytime. You should be prepared for that, right? So right now we are half in this bootcamp and soon all the things will be delivered from my side and you will be getting every knowledge, right? So like if you have proper knowledge and there will be opportunity in front of you, like you need to appear for interview. So like for that also you can prepare side by side. So here you can see after each section you will find interview question and answer. So you can go through with the document. So if you go with this document, so here you will find interview question and answers playlist. So we are all the videos are available. So I think if you prepare well, so you will be paid well as well, right? And if you want to follow telegram group where you can ask questions, so you can just scan this QR code and you can be part of that group. If you are already part of that group, you might have experience like people are asking questions and like answering each other so that like proper learning and sharing platform is there. And that telegram group is not having any paid promotions. In telegram you will see there are lots of groups available where people are doing paid promotion but Sanjay Gupta Tech School Telegram group is a unique one where no paid promotion is available. Everything is totally free for the community, right? And you can see we are in week 15 where we are going to discuss various topics related to S and Cronus Apex. So there will be total four sessions this week and in four sessions every day I will be covering particular topic. And you demanded like we need to know basics of visual force that I will be covering next week. And after that week, week 17 and 18 are dedicated for integration related topics. Okay, so if you want to receive timely notification, if you don't want to miss anything, so just follow Sanjay Gupta Tech School on these platforms, right? So like recently last week I announced one more bootcamp that is related to C and C++. So I was getting lots of queries from the beginners like we are not able to learn development properly. So then I decided like let's do a bootcamp on C and C++ so that I can target students, freshers, those are related to BTEC background and the professionals who want to start their journey as a developer because C and C++ are the basic programming languages that everybody should know so that you can understand the concepts of logic building and then after learning C and C++ you can directly jump on to the Apex, right? So that bootcamp will be starting from the first week of June, right? So there is one telegram group created so link is already shared in the main Sanjay Gupta Tech School Telegram channel and if you need more information so let me know in the chat I will share the link with you as well. Okay, so let's start this topic now as in Cronus Apex and if you have any question, whatever I discussed so far, so just throw your question in the chat. After a few slide explanation, I will be taking your questions because first I'm going to give you introduction about as in Cronus Apex and before starting explanation of future method, I will take your questions. So if you have any questions, so feel free to post those questions in the chat. Okay, so now we need to understand what asynchronous processing is, right? So basically, whatever we have done throughout the Apex programming, so we implemented the code and we executed that code immediately so that we can receive some results, right? So that Apex processing is basically known as synchronous processing, right? So whatever we have done so far that is known as synchronous processing, right? Now we need to understand asynchronous processing. So it is also very easy to understand, right? So an asynchronous process executes a task in the background, right? So you need to remember first thing, asynchronous processes never execute immediately. They runs in the background, right? So user doesn't have to wait for the task to finish. And you can use asynchronous Apex for these many tasks like for integration purpose, we need to connect Salesforce with any external system, right? So what we need to do we need to create call outs, call outs to external system that is part of integration. So for example, if you are integrating Salesforce with any external system, and that external system is not available at that moment. So what you can do instead of implementing a synchronous process because in case of synchronous process, if it is not executing at that moment, so all the following processes won't be executing. But in case of a synchronous process, if you are not able to access particular resource at current time, so your asynchronous process will be processing that later stays, right? And at later stays that the task will be processed. And the following tasks, those are aligned with that asynchronous process, they will be executing immediately. So in reality, basically, we create combination of synchronous and asynchronous processes, right? So synchronous processes runs immediately an asynchronous process runs in the background at later stays whenever resources are available. So in integration, basically, we prefer asynchronous processes, then operations that require higher governor limits. So in that case, also, you can prefer asynchronous process and code that needs to run at a certain time. It means if you want to schedule your apex code. So for that also, you can leverage the functionality of asynchronous processing, right? So these are few, these are few factors or few areas where you can use asynchronous process, right? So in interview, like interviewer can ask like differentiates synchronous and asynchronous process. So for that, whatever I explained right now, you can say, and you can take these three as an example, right? There are lots of example that we'll be discussing later in the session. So these are some benefits of asynchronous processing. So you can see, you can use your resources efficiently, because if resource is not available at same time, so what you can do, you can, you can like schedule some processes that will be running at particular date and time, right? And if you, if you want to run that process in the background, whenever resources are available. So like that also can be done with asynchronous processing. So these, these are basically used to increase your efficiency, right? Then scalability with asynchronous processing, you can scale your system scale means you can enhance functionality, right? Because asynchronous process runs in the background. So whenever resources are available, they can initiate their execution, right? So the current processes won't have to wait if you have asynchronous processes. And we get higher governor limit so that we'll see later on in the slides. Now, after understanding brief about asynchronous process, now we need to understand how many types of asynchronous processes are available. So generally, there are total full types of asynchronous processes available. And this is also one of important question. If we focus on interviews, right? In interview, generally, this question is being asked, like what type of asynchronous processes are available in Salesforce, right? So you can see first one is future method that we are going to discuss today. Second is batch epics that we'll be discussing tomorrow. Now, why we use future methods. So if you want to run anything in the background as a separate thread. So in Java, those who have gone through Java, so in Java, there is a concept which is known as multi threading, right? So if you want to execute your code immediately, so that is basically known as synchronous process. Now, with that synchronous process, if you want to run a code in the background, when certain resources are available. So in that case, you can implement a future method. So future method will be running in a separate thread. So your immediate action will be running in a separate thread. And your like your asynchronous process will be running in another thread, right? And in the background, and it will start whenever resources are available. So generally, for web service call out for integration purpose, we prefer future methods. If you want to connect your Salesforce or with any external entity, external service. So for that purpose, we can write our code in future methods. So whenever that resources are available, then your process will be executed automatically, right? And it is very simple, like you just need to use at the rate future annotation to convert your method into future method. Okay, then we have batch epics. So batch epics basically run large jobs that would exceed normal processing limit. So a simple example is like if you want to do something on your existing data, if you want to do something on your existing data, so for that purpose, we need batch epics. batch epics never works on the newly created updated or deleted data. If your data is already available in the org, right? And you are doing nothing. Still, you want to query the data and you want to apply some process on that existing data. So maybe for data cleansing or archiving purpose, so you need to remove some records, those are no longer required, or you want to populate some value for large number of records. So those you can do with the help of batch epics, right? So next, third is cueable epics and fourth one is scheduled epics, right? So cueable epics is extension of future method. So future method has some limitations. Future method is basically having some limitation. To overcome those limitations, we have one more feature that is known as cueable epics. So cueable epics is similar to future method, but it provides some additional features. For example, it provides job chaining, right? So you can call one cueable epics through another cueable epics that is not possible with future methods. So job chaining is possible like if one cueable epics process is completed, so it can call another. So in a sequence, they can execute, right? And it can allow more complex data type to be used. So basically, when we use future method, so future method basically receives primitive data types as a parameter. Primitive means like integer, double string, ID. So these type of data type, your future method can use. Now, if you want to pass complex data type like S objects, your custom and standard object types, so in that case, you will be using cueable epics, right? So it depends on the requirement whether to go with the future method or to go with cueable epics. So if you want to perform sequential processing operation with external web services, so in that case, you can prefer cueable epics. And you want to perform any one operation, then you can choose future method, right? Then we have last one is scheduled epics. So it is similar to schedule triggered flow. So in flow, we have a type which is known as scheduled flow. We can schedule a flow that will be running at particular date and time. So similarly in apex, we have scheduled apex. So schedule, you can schedule your apex class that will be running at a specified time. So if you want to run a job on weekly or daily basis, so in that case, you can schedule your apex class, right? So these are four types available. And all these types you need to remember because these are very much important if you are appearing for an interview. Okay, now let's discuss about governor and execution limit. So asynchronous epics provides higher governor and execution limits. So in case of asynchronous epics like then as you get higher limits with async, also those governor limits are independent of the limits in the synchronous request that cued the async request initially. Okay, I guess there was some network issues. So I am just going to explain these again. So basically I was discussing about governor and execution limits. So asynchronous epics basically provides higher governor and governor and execution limit, right? So it means like if we talk about a SOQL. So in second point, you can see a SOQL basically having 100 limit in case of synchronous processing. But in case of asynchronous processing, it is having limit as 200, right? So that you need to remember. And if we talk about heap size and maximum CPU time are similarly larger for asynchronous calls. Okay, so this you can understand with the documentation. So let me just search for governor limits. So if we search for the governor limits, so here we have a document for epics governor limits. And if you go through with this, so here are the limits. So you can see, so go through with the table. So you will be able to understand the limits properly. So few limits are same and few are having some differences. Right? So let's say you can see heap sizes six MB and here for async, it is 12 MB CPU time is also different, right? So I'm going to share this document with you in the chat so that you can go through with this. So this is important to understand governor limits. So for few areas like governor limits are different, but for few they are same. Now last point is also important as you get higher limits with async. Also those governor limits are independent of the limits in the synchronous request that queued the async request initially. So what does it mean? If you have a synchronous process and if that synchronous process is initiating any asynchronous process, so both will be having separate governor limits, right? So this you need to remember. Okay, so moving forward now next is async processing challenges. So there are a few challenges as well like how we can ensure fairness of processing. Like if we have more asynchronous processes queued, so which one will be executing first so that we cannot decide. It is totally dependent on the system, right? Then we have another challenge which is ensure fault tolerance. Like what if your process is failing in the background? What will happen? How you will be getting to know like your processes failed or what you need to do? How we can overcome? So these are some challenges which are available with asynchronous processing that you need to remember while implementing these. Okay, next we have like how async process works. So basically first step is and queue like your whenever you are initiating your asynchronous process so it will be queued and then it will wait for the resources so that step is known as persistence like if resources is available then process will be started and when that process is completed. So in that case your process will be dequeued. Okay, so these are three major steps which are available with asynchronous processing. So now we need to discuss about future methods. So like future method I will be demoing you how we can implement. Before that let me take some questions that you have asked in the chat. So I am jumping here. So Direndra is asking I just seen your video today and really appreciate efforts. Thank you. But I have one question that I have never seen your previous video. So should I start with day one or yeah, you need to start from day one because you joined from the middle you won't be able to understand. So here we have a sheet where all the sessions are available. Right? So here you can see sessions links are available and the link of this sheet is available in the description of the video. So you can have it from there. And I think internet is causing some issue. Going to take next question now. So case so Jenna like integration topics will be taken by some experts. So I will be sharing details about that soon. And so didn't I already answered your question? I think internet is not working properly. I hope you are not able to see it clearly. Let me just change. Okay. Now I think it is clear. Okay. So next question is apex is multi threaded. Yes. So for synchronous we can have separate thread for as in course we have separate thread. So you can say it is multi threaded. So Chandan is asking what our resources and archiving of records. Let me just switch the connection again. Okay. So sorry, there is some internet issue. So yeah, so I'm just fixing that. So now I think it will be visible to you. Okay. So next question is what are resources and archiving of records. So resources means the like memory or external services that you are using. So in integration we connect Salesforce with other systems. So those are will those will be known as resources and archiving means like if you are removing some records from the org that is basically known as archiving. So each session is for one hour. So accordingly you can do the calculation. So there is one more question schedule apex and batch apex are same. No, they are different. So when I basically for some asynchronous processes you won't be able to set particular date and time. But for few like for batch you can schedule but for future and cueable they will be working whenever resources are available. So Jenna like this process will be working in the background and like for external resources we will be using these processes and they will be working on the bulk data. So that's why limits are higher for asynchronous processing. Yes, Archana, we need to write test classes as well. Yes, we can use triggers with as asynchronous like future methods you can call from as synchronous process as well. So for us if you want to call. So initially like in the last release there is one feature through flow you can do callouts. So with the help of that callout you can just implement as synchronous process and flow as well. So Shrivali is asking only future and cueable are when we integrate with external system and do integration rest to batch and schedule are within the system. Yeah, so generally batch and schedule we use for the internally. So we already shared the link where government limits are available. You can go through with that. So again, the thread means a process. So basically as synchronous apex are important. So triggers basically execute immediately. But as synchronous process runs whenever resources are available or you can execute them at particular data and time as well. Right. So that's why they are important. No Archana as synchronous process doesn't affect order of execution because they are not executing synchronously. So they don't affect order of trigger execution. So Sudha interface and class both are different. And in case of asynchronous we will be implementing some interface. So by the end of this week you will be able to understand. So submit if you want to find some module. So like on trailhead you can search and you can do few. Otherwise I will try to list few for you. Okay. So I just explained a whatever question I saw in the chat. Now moving forward and sorry for the internet actually there is some lag today. So quality is not up to the mark. So I'm just moving forward and explaining future method. So this is the first type of asynchronous process. This this this type is basically used when you want to like call out external systems through Salesforce. So in integration basically we prefer this future apex. So in future apex basically we implement future methods. So future apex basically runs process in a separate thread and at a later time when system resources become unavailable. So you can use future annotation to create future methods. So it is important. So we need to use adderate future. So if you use adderate future annotation so you can create the future method. So it is simple like you just need to create an apex class and in that apex class if you annotate your method with adderate future so it will become a future method. And in synchronous processing all method calls are made from the same thread. And no additional processing can occur until the process is complete. So this is the drawback of synchronous processing. That's why we need asynchronous processes. So in a single transaction if you want to initiate one initiate one sub transaction so that you can do with the help of asynchronous apex. Right. So Rajiv in real time situation they will be executed automatically. We don't need to call them through developer console. So Sandeepa like resources means here if you are interacting with any external system other than Salesforce so that external system will be treated as a resource. So Rohit I already answered like in case of future and cueable if you are interacting with the external system so that external system will be known as resource and resources available means when you are trying to connect your Salesforce with that external system. So maybe due to network issues or any other reason you are not able to connect with that external system immediately. So in that case your external your asynchronous process will be waiting until that resource is available to connect. Right. And other processes you can run synchronously. So this is the basic meaning of resources are available. Yeah. So Sunil let me just explain these one by one then I will be showing you the all the best practices related to future. So generally we call future method through triggers batch schedule and cueable. So we never mix them. Right. So if you want to call future from cueable so we never do that. You can call cueable from cueable. So we never mix everything because all are for different purposes. So moving forward next we have like whereas in future method methods run as synchronously in its own thread this unblocks user from performing other operations. So the operations which you want to run immediately those will be part of synchronous thread and the process which you want to run in the background those will be part of the asynchronous process and it provides higher governor and execution limits for processing that we already saw. So this is the basics about future method. Now if you if someone asked like when to use future methods. So first is call out to external web services that we already discussed. Then the process that needs to execute in a separate or own their own thread in that case also you can use future method. And sometimes we have an error like if you are working on different as objects and you receive mixed DML error. So in that case like if you are in a single method if you are processing two objects and you find mixed DML error. So what you can do in that method you can process one object and through that method you can call your future method and in that future method you can process your second object. So your process will be same. Initially your process will be same. But that synchronous process will be initiating a asynchronous process. So they will be executing in two different threads. So your mixed DML error will be resolved with the help of future method. Okay. So this is a syntax like how you can implement your future Apex class and future method. So name of class can be anything then you need to use at the rate future annotation then public static void that we used already then name of the method it can be any name. Then here you can receive primitive data types only. So primitive types and their collection only primitive and their collection. You cannot work on S objects here. Right. So this is a limitation of future method. And whatever data you are getting here. So basis on that you can retrieve all the records and then you can apply the process. Right. So this is a syntax of future method. Now I'm going to give you a demo where we'll be implementing a scenario. So basically jumping here. So what I'm trying to do here on account object I'm going to create a field. So let me just check. Okay. So what I'm going to do through this future method I will be counting how many number of contacts are available under particular account record. Right. So what we can do first of all I'm going to create a field of type number. So I'm going to create a field of type number. So I'm naming it as count number of contacts moving forward. So here like default value I'm setting as zero clicking on next visible to all the profiles clicking on next and save. So basically I created a field that I'm going to use in my future. So field is count number of contacts. So I'm copying its API name. Now moving to developer console. So here I'm going to implement my future apex. Right. So I'm going to implement a class naming it as account calculator. Right. So in this account calculator I will be implementing a future method. Okay. So first of all what I need to do I'm going to write an annotation that is at the red future. And then I need to implement a method. So public static void and naming it as count contacts and it will be receiving list of ID and storing it into account IDs. Right. So this is this is basically my implementation of future apex. So account calculator is the name of the class. And here I'm going to implement a future method. So this future method basically you can call from any other class or trigger if you want to execute it separately. So right now I will be demoing you like how we can call it through an RMS window. But in real time scenarios you can call it from anywhere from where like you want to initiate a separate thread and you just need to pass a list of account IDs so that those can be processed. Okay. So now here I need to implement the code. So what I need to do here I'm creating list of account. So I hope everybody knows like what is parent to child SOQL. So I'm going to use that only right. So this is a simple parent to child SOQL that I that I have implemented here. So I'm just querying ID of account and then all the related contacts from account where ID in this ACC IDs list. Okay. Now I'm going to implement a loop that Lou will be trading that account list. And here we have. Okay. So what I need to do I'm just saving it and I'm going to refresh it because I created one field and I didn't refresh developer console. So I'm just refreshing it so that that field is available. And I'm going to open. This is the class that I'm going to implement account calculator. Right. So here now I can write ACC dot and then API name of that field count number of contacts. And then what I'm going to do I'm writing ACC dot contacts dot size. So this I hope everybody knows those who are following this bootcamp. So basically in case of parent child SOQL whenever I'm iterating on this account record. So this account is already having all the contact related information. So through that ACC dot contacts I'm just calculating size of all the related context like how many contacts are related to particular account and that counted value will go to this field. Right. And after this what I can do I just need to update this account list. Right. So here I'm just going to do an I'll check if it is not empty then I can write update ACC list. So all the account records whose ID is available in this ACC ID those account records are already available in this ACC list and they will be updated. So whatever number of contacts are available accordingly that will be updated. Right. So this way basically we need to implement a method. Right. So this process will be running in the background as synchronously. Now how how you can execute this process. So for that purpose I'm going to implement some steps and initially that I will be implementing an anonymous window. So I'm just querying some account records that I created list of ID then iterating a loop so that I can store IDs. Right. Now after this what I can do I can just call this account calculator here. Account calculator dot count contacts and here I can pass ACC IDs. So this statement will be used like if you want to call your future method from trigger. So trigger will be calling your some method of apex class and that method will be calling this statement and that method will be passing few account records in this manner and that process will be initiated. So now what I'm going to do I'm just unchecking it and clicking on execute. OK. Before that let me show you one more thing. So under this home you will find so let me just zoom it. So here you will find one option that is a big jobs. Right. So here you will see whatever as in Corona's process you are initiating. So right now you can see this is blank here there is no jobs available. Right. It is right now blank. No records to display. OK. So now what I need to do I just need to click on execute. So all the statement will be executing. Right. So whatever records we passed whatever records we passed from here they are processed and how you can verify them from here. So you just need to refresh. So here you can see one future entry is available. So date is for today's first of May. Time is 748 a.m. It is PST time job type is future status is completed. And here you can see total batches batch processed submitted by completion date apex class through which it initiated apex method which executed and a big job ID. So all the details are available. So this validates like it is running in the background. Right. So this way you can just initiate a process and that will be working. Yeah. So we shall identified one thing like we are not wearing this. Yeah. This is good. So I think we can put it here. So this way you can modify your code so you can just query this field as well so that it will be modified. So that's why it is not saving it is giving some error. Here I need to put a comma as well. Yes. Now errors is not available. It is resolved. Thank you Vishal. So so this way I hope you understood how we can implement our future method. This way I just called for demo purpose. And if you want to see whether it is executed or not. So here under apex jobs you will be able to now we need to understand how we can implement its test class. Right. So it is also easy because in test class you will be creating the data and through that data we will be validating whether whatever code we have implemented that is working fine or not. Right. So now I'm going to implement a test class for you. So you know the best practices for test class whenever you want to implement the test class. So in that case you will be using the same name account calculator and we'll be appending test at the end. So this way I'm going to create the test class so account calculator test and I'm clicking on OK. OK. So here account calculator test is available. Now I just need to create some data. So first of all I'm going to put at the rate is test in the beginning. Then at the rate is test before creation of a method. So here I'm writing private static void count context test. Now list of account ACC list equals to new list of account. So now here I'm going to create some records. So I will be creating 250 records. So I already told you when we studied about test class we need to implement test classes for bulk testing. So this way 250 records will be created. Right. And here I'm writing insert ACC list. And if you want to use test dot start test or test dot stop test so you can use those as well. Then I'm creating list of contact and a list of ID where all the account IDs I will be storing. Right. So I think this initial part you are able to understand because here I'm just creating the data whatever data is required to test the test class. Right. And instead of writing it here I'm going to shift it at the bottom because we'll be calling our future method as well so that you can include inside this step. So now after creation of this contact list and account IDs what you can do you can just iterate on that account list. Right. And we just need to add some context. So we created only accounts. We didn't create contacts. Now what I'm going to do I'm creating some contacts. Okay. So instead of this let me just create con variable. So here I'm writing con dot first name equals to test con dot last name equals to so whatever is the account name that I'm going to store as a last name and I'm going to link this contact with account. So this way it will be connected and then con list dot add and that con. So the contact which we created that will be added into the contact list and acc IDs dot add acc dot ID. Right. And here what you can do after completion of loop you can write insert con list. Now after inserting contact list so what you can do like what you can see here we inserted all the accounts. Then here we inserted all the contacts which are related to account. Now I just need to call that future method account calculator dot count contacts and here I'm passing the IDs. Okay. So these are the IDs account IDs which I collected through this loop and I'm passing it here. So what will happen on account record we just created that field and that field will be having a number of accounts which will be counted with this future method. Right. So this way like what what we are doing we are just testing whether a total number of counted contacts will be available on account or not. Right. So here calculator. This is a mistake typo. Now after this what I can do I just need to query the records. So I am just squaring that field as well from account. So whatever account like 255 250 account records we created. So those we are querying and we just need to validate this. So right now what we did for each account we created one contact. So the value of this count number of contacts should be one. Right. So I'm writing system dot assert equals. So expected will be one. Actual is available into this list ACCS then zero dot and then I'm going to have that field. Right. I'm just shifting it to above so that you can visualize it. And here I need to provide a message. So message I'm typing contacts are not counted successfully. Right. So this way you can implement your assert equals. So it is showing some error. So let me just check it. Line number five is having some issue. OK. So here I just missed this closing bracket. So I'm just saving it. So this way our test class is implemented. Right. Now here you can see run test button is available. So moving to test and clicking on run test. So this test class will be evaluated. So it is actually failing. So let me just see the error. OK. So here you can see it is failing because while creating account we didn't provide some value into the account active field. So what we need to do we need to go here and we just need to put some value under active field. So here I'm providing it as yes. Now I'm going to click on run test again so that I can see whether it is working fine or not. So it is taking some time. So let it execute so that we can see whether it is working fine or not. Yeah. So this time you can see it is executing properly. And if I go here and if I check so 100 percent code is covered here we can see all the blue lines. So this way you can implement your test class for future method. Right. Now moving quickly so that I can explain you all the best practices. So you need to ensure future methods execute as fast as possible in case of web service call out try to bundle all call outs together from the same future method rather rather than using a separate future method for each call out. So it will be saving your time test that a trigger and queuing the future calls is able to handle a trigger collection of 200 records. Right. So this is important if you are calling your future method through triggers. So in test class you need to ensure like you're testing it for more than 200 records and to process large number of records are synchronously use batch epics instead of future method. Right. So for less number of records you can pick future method. But if you have large number of records then you can go with the batch epics. Then these are some important things that you need to remember. So use at the rate future annotation method and it must method must be static. If you are using at the rate future annotation so your method must be static future method can only return a void type so it's written type will be void always. Then future method can take primitive data types area of primitive data types or collection of primitive data types as argument. So only primitives and their collections future method cannot take objects as argument. So this is the limitation and that we will be resolving with the help of cueable epics. Then it can happen that future methods are running in different order as they are called. So if you have initiated more than one future method so they can run in any order like as their resources will be available. You cannot call a future method from another future method but you can call of cueable epics from another cueable epics so that is possible. And there is a limit of 50 future calls per epics invocation. So there is an additional limit on the number of calls in a 24 hours period. Right. So these are some points or things that you need to remember if you are working with future method. Right. So I hope with this demonstration you are you have understood how it is working. And there is one example available in the exercise sheet. So if you can implement this at your own. So just go through the recording and first implement what I explained. And then you can try to implement it and write it's test class as well. And for reference prerecorded videos available if you stuck somewhere you can go through with this. Now if you have any question you can ask. So generally we don't mix so people are asking like can we call it from there. So generally they fulfill different purposes. So we never mix any of the features together. So shriveli this web service call out we'll see when we'll be discussing about integration. Right. So that piece will be understandable there. So shriveli is asking about point number three. So point number three is so which one can you please tell me like this data type one or this limit one. So shriveli can you let me know which one you want from which slide. Okay. Meanwhile I'm just waiting for her response. So if you have no question you can leave if you have question you can ask in the chat and do practice because as in Corona say PIX is also important. Yeah. So there is no limit as such. But if you have millions of records so I think in that case you need to go with the batch. Okay. So this is all about introduction to as in Corona say PIX and future method. So implement it. Yes. Chandon invocation means calling and sorry for today's bad streaming because there is some issue with the internet. I cannot do anything with that. So stream is a little bit blurred but I try to demo you with the help of zoom in. So I think you are able to visualize it. Okay. So I take your leave now and tomorrow I will be discussing about batch ethics. So join every day session because you need to understand these properly. These are very much important as per interviews perspective and project also and in integration a few of from here will be implemented. Yeah. So how to monitor the future method that I already showed you. So from here like you can see we need to search for a big jobs. If you search a big jobs here. So you will find this option click on here and here you can monitor. You will see everything about the future method whether it is completed or failed. What is the status. Okay. Any more questions. So if you have more question please ask otherwise you can just leave. We have one more session at 9 p.m. So if you are joining those you can Praveen I will try but I cannot assure you because we can if I will be free then I will surely take. So here also you can see lots of examples are available for asynchronous apex. So you can go to study sales force dot com under developer section you will find asynchronous apex. And here you will find lots of examples. And somebody is asking can we schedule cable epic. So generally we schedule batch epics cueable. I don't think we can. So I can see a few more questions. So Arjuna I already showed you like from here you can track whether there is error or not. So status will show you if it is completed like your future is finished successfully if it is not then here status will be failed. Naveen 25 videos are there. I need to create some more I'm not getting enough time but there will be more no such in and generally future and cueable we don't schedule because these we use for calling external services and like we implement them with the help of future and cueable because if resources are not ready then they will be running at later stays any point of time whenever resources are available. So we generally don't prefer future and cueable to run at particular time for that we use batch epics because in batch epics in batch epics we have a method where we can query the data as well. We don't need to pass any data. So that's why it is easy to schedule that in future and cueable generally we need to pass some data. So if we schedule them we won't be having some data to pass. So that's why they are generally called through any other method because we need to pass some data as a parameter. Yeah. So more about batch and cueable we'll be discussing in tomorrow and day after tomorrow than I think you will be able to understand more. Okay. So no need to worry. Okay. So I don't see more questions now. Thank you so much for joining today's session and tomorrow we'll be discussing about batch epics. Thank you so much for joining today's session.