This conference will now be recorded. Okay, the moment I said see Julia, Kenya we discussed about this Julia how to create the soldiers and I discussed about the effects. The moment you see do something to Rauner tapes future time, then that job we can get under Schindler's. So, to get that under the set of if you go under the monitor or monitor you can see monitor then you can change jobs. And those have just given it this conference will now be recorded. The moment I said federal jobs if you go here, and you will get this is one place your jobs and the optics, so you can get here.
So what is the basic difference between these so now The moment is to the jobs that means you are not turning the job right now, we are doing that job to door maybe after one hour or maybe in a month one time in a month you understood it okay. So, now what happened what happened here if you go here the jobs till the time not executed everything will be understood your job. So, if nothing but if you do too long at a particular time in a point this job processed then it will come under affects job with a satisfied kind of Java does the all the background jobs for the learning everything will get an epic serves see these topics is already executed Okay. So now, this job we executed at a certain time. So that time nothing but if you see on shuttles when this job indicated so at this time Okay.
So, these job then move to a next job. So, what are the jobs running in the system that job you can get in a picture. So, it is nothing but a database it can be it can be scheduled and it can be your report it should be a report that also can come here okay. But only the classes or anything which we do to run at a particular time that you can see here is just a mechanism where you can simulate okay, but once when these jobs are being processed, all the jobs will come to this place okay. Also you can see something called flex queue. I said all the jobs what you are going to decode everything will be will be maintained in a queue.
Okay, when that processing started, pass, it comes to queue so that nothing but whatever jobs let's see, I have 1000 jobs to run today. Okay, all the jobs are in studying Everything will come to the Plex queue okay then go into the hundred job ticketing then that will go to the epics who what is the current job or whatever jobs we have interpreted in the system this is a basic difference but my point okay so then what is the batch Apex the first one in the list this job see all or nothing but maybe maybe database or maybe one scheduler okay everything is a job for me okay. So what kind of epics avoid all the epics Are we on nothing but a better Excel. Okay, let me show you in detail about it. If you go to Object level there's open the object of this I would think a big job even even will run like you will discuss one more concept here which you call feature feature method and that feature method or key will method everything will come to here a different type of job type you can even kill job type, it's a picklist type, let me show you part of the hello we have been a singer a singer that type condensed may be a soldier which may be better bass so any type of a synchronous job you want the good okay everything will come in the end while educating everything will come under a single piece shops okay.
So but how will identify what type of process that is depending on the job type. It can be basics, it can be subtle effects. So it can be a future method Okay, or it can be cable interface instead of a cable interface for a pipe during a synchronous method. That can be cable. So with these tiles, we identify what kind of job it's going to do. Okay?
So, each For example, let's see, you have a sharing rule. Okay? So some some time you ride sharing rule programmatically, okay? So if you want to recalculate your car rule completely from system, it's nothing but a background job. So that also covers so it's a picklist type, which identify what kind of job we are processing. So here you can see okay, the job we don't call our with class icon badge, that's nothing but it badge depicts type.
So we understand Okay, this is nothing but a bad job. We have returned fortune due to efficiency to lunch, nothing but this job. There is a scheduler which we, which we do in the system, and that's the Deuter at certain time. Okay, at this time. point I submitted this one, the nine who see all the jobs comes here and it usually starts at this point. Okay, so a batch effects jobs that means if a job type is batch effects that is not scheduled that is not reviewed the ability to do that will come through Okay.
Got it, okay. So, now we know how we can write better specs how we can execute. And we have discussed what is the best practice for writing it as it is. So my point of writing is to learn what is the best practice for sigil sigil of a particular part of the history so, you have to follow the part of the limitations we have to take care. Okay. So, again I'm saying we'll schedule to roll at a particular time if you see this job we should do to run at this time, every day 7am I'm running this job, I have to delete.
So now, we supposed to honor seven m so it does not mean exactly our seven o m, it will run. So again, it depends on the server availability Okay, so that means we should do the class okay. But actually division may occur at that time or it may be late okay. So depending on server availability by the CSM same thing what I said to you during the reception Okay, so if all resource available then it will exit again. So let's see I am writing in logic okay let's see system dot c dude I wrote some had intellectualism. So, if I had ordered this one again her take care how many sigil we should integrate in the system.
So if it triggers you in many records and if each time a lot also dealers going to create the new should take care so that many sellers should not see Do you have a trigger all the rates will go one hit the governor limit. Okay. So to do that We have to imagine limitless okay. And we can check what is the current limit allocated and how much I have used to unfold I need to simulate or summarize in do it after some time okay in that so now, these graphics are database whatever I say all or nothing but one a synchronous operation for me, so, it's nothing but my background job which is executing, okay, at a certain time. So, whenever you have a synchronous operation, and from this closure, I want to make another a single operation, I think let's see, I want to make a call out from this.
So if you want to make any call out and like any legacy policy, you know, or you want to make a service call nope okay. So, I want to invoke a web service which is going to connect to external system to get some data or maybe to pour some data from my system to another system. So whenever you have called out promise you do not pick so that you cannot straight forward riding okay. So whenever Even anytime you have a we should call out okay the dots will not go to invoke I just introduced a person to me. So all the a synchronous operation whatever you have, that should be as a a synchronous mode and to make that call out to be invoked from a erotics, always remember, we have to animate that with future. And inside that we have to specify call out the courtroom, why no point?
Then you can use this one to understand how we're doing how we're going to do it. Okay. Any convenient alone. So basically, so call out is basically used for web services. Correct. So now, let's see, I have one scheduler here.
Let's make you're going to do from this piece of folders. I have some piece of code what I have written and it's going to integrate. So now from the line of code I want to make a call out. So now I have some internal system where I'm calling to do some logic and I don't know how much time it's going to take it's a external system. So now what will happen whenever I am here, so my surprise one cannot wait till I get the responses okay. So what will happen here?
So in that case I will delegate this operation what I'm going to do it should happen in a separate transaction okay it is a potential. So to make that separate connection, I have to earn it wait Okay, are the red future then call out a call through that means something to my signal effects okay. There is a call out happening or allow it to run in a synchronous mode again. Okay, any we didn't discuss about future method till now. We will discuss in the next lesson. What is the future For what we can do there Okay.
And then remember what are the limitations we have when writing a better fix okay. So again So, we can see do maximum hundred jobs at the same time. So maximum at the same time, okay. Like timestamps would be the same, we can have maximum hundred jobs, okay. If you will really execute more than 100 jobs at a time, then you will get again the concurrent exception like what I said in no better fix. Okay.
So, all these similar in essence, if you want to get it or you want to query it, then we have to use Chrono Trigger as I said, we have we have we have a query on the Chronicle you can write to get how many number of jobs we have, how many jobs are being processed everything and all the job information so we can we can get in the cron job. Let's So, with that objects going here, let me open the object again see cron job detail and transient. So, contract under the word it contains what are the pseudo classes we have scheduled. So, when it is going to higher these are going to describe what is the current state everything let me right now just scoring everything I have very few similar so during my time, we can see what is the current expression Okay, how many time is triggered everything we can see here okay.
Let me execute this query. So now I have to slow up if you see here in the system, I have exactly two jobs on batch similar accounts. So now you see here, I got two records. So now you see my starting I started a part time and opponents processed and uploaded, make your next lesson and how many demonstrate good already. Okay, so if you see this one, this is already Included sytems on 18th or 19th and 20th included so on 20 patents pending prosecution. So how many time this job is being executed according the cron expression parties everything you can get if you query under contract so I'm not saying you remember all the things all the object name simply you can go on and on the pile then object open okay then from the object just see the object now if you do it then you can get in this object we have all this abundance This is just how many should you know i have in the system we caught it and how many times it says we're going going these upon best Julia Jude, okay, at a particular time, it says looted, so that means it's created job.
So that job anymore Do we get an epic so to get that job, in essence, what we can do, we have another object, which we call con job written. Okay, so see, we have only job Name the type and a job ID if a query that I have two jobs which are suited for the job temp job Amazon seven seven the keyword my skill epics this yes so in both the objects we saw the scheduler jobs but what about the batch effects which is there in the epics job list we don't yeah okay for the better pace they said that day if you go to this object everything we can get into I think epics job okay yeah okay you remember this has never stops yeah we can all do people do when they might figure all this out to you okay it condensed everything so what to do here so we can cool filter on the type for this main job type you can filter it over here okay.
So that will do it. So now so it thank you can configure maximum hundred jobs to run okay? And in a whole day in a 24 hour period of time how many jobs are going to do same as residents? Okay, maximum two lakh citizen jobs Otherwise, your number of licenses, let's see how many number of licenses you have relicense into 200 who is maximum that mean number of jobs so you can see do to do for the in the system. Okay? See the other strategies is to remember, okay, when you implement you have to keep these things in mind.
Okay, what to do? And you always remove one point whenever you want to make a purchase for load. Okay, then always you choose use future with an additional color true. condition. Okay. Anyhow, we'll we'll talk about future methods, and we'll see what we can do.
Okay, so now Okay, do you have any any confusion for me Okay, so now, when I'm saying this future, then what is his future? What does he do? Okay, so now whenever I'm seeing a future method, so let me show you this batch depicts whatever I have written, or this regular, whatever I've written, okay? It's I'm invoking, in the backend, as a, as synchronous operations, it may be by the system virtual job, or maybe by a batch job. That will actually me I'm educating, you can now I will have a scenario, okay, I'm just executing one trigger, my trigger code is fired now. Okay.
So from the trigger, this is a few lines of code I have written okay. And I'm including it. So now, from here on agent says, I want to hit this these three operations what I have, it is going to take a little bit more time. It's a time consuming Timing time consuming logic which we have and the output of this logic we don't need in my system okay it's just a background operation I want a good okay where my synchronous connectors are nothing but a synchronous function, the synchronous transactions not going to impact on the addition of these three lines of code for example, and these lines of code what I have is going to consume a lot of time in my system okay. So, what I can do I can I can make these three lines of code as a future call it will execute in the backend as a separate transactions okay where I will just split my source what I need to using the trigger and this is a different okay.
The governor limit what I have the governor limit applicable on this trigger and on this future method will be different. So, what it is and how we can do it. Simply remember, pitcher method always launch in the background Okay and these are methods known as a synchronous. So, like back database like your signal wrap is future epics also runs in background as a synchronous method or a synchronous call okay. So, always you will use this future method only when you have a long running process. So, like you have a logic which maybe interact to some external system or may interrupt a large volume of records by manipulating the data, okay.
So, that time when you have a long running process to execute, okay, like it may be a service call out nothing but integration code or maybe you have a bulk of data which you need to manipulate. Okay, that moment, that piece of logic, right in a future call. Okay, so whenever I'm writing a feature called see everything in this class, whenever you're writing it better is nothing but a class with a special implementation of interface. When you write a pseudo class, you see a faceless, but when you implement interface, then we call it as a pseudo class. Same way, whenever you are writing a future method or a future class, then what we'll do. So your class name, let's see, I'm just writing a simple class here.
Let me write it on this one. This is another see I'm just going here. Okay, so now I'm going to create a new class. Let's For example, I just get the neighbors. Count features a proper listening game. Point ACDC future just the classes are covered after class.
So, inside the first class I'm going to write one method. Let's see, I wrote one method which I called hello yeah yes. Yeah there is one question there is some batch epics or future method or any call out is there then how to find out how many calls Is there a perfectly according to the application, how many applications making which call so according to that, can we find out in sports? It see how many call outs you have then again Texaco seen for transaction you have how many calls? Okay, I'm like how many are synchronous calls for transactions or it may be how many total a synchronous call you executing in the system. Okay.
So always we target based on fortunately transaction, how many I think close calls. You get to get that What you can do let me put a debug log I'll show you what what I mean. Okay, I'll show you right now. So here you go to debug log if you want to see four tracks on how if he goes savings account if from that account save to complete that in essence, if anything happened in the system and any cold happened okay to get that let let me pull some debug logs here with the filter I'm putting as a call outs see here you can get all informations what called happening or not and you can see our profiling here also you can get how many users you have used. Okay, let me quickly just try to put one transaction so that we can see what are things coming in my debug log.
Okay. So, on my name, I have kept a debug log here. Yeah, that means you it will it will give according to the user, but I want from the organization how many applications have got used and how many call out are there I can see in report but it is not detailed information. So, again okay there are multiple ways see, we have something called limit class, okay. So you can use limit class to get it how many number of resources we abuse how many colors that we make, or if you want in my application, okay, we are in my system in today, how many call outs or how many API calls we made now, okay to get that we have to use workbench Okay, from the workbench, we can see that anyhow I will teach you this workbench okay. In that part, I will cover this these things, how we can see what are the limitations we have used, how many available for me and how many we have used Now, everything we can see from this workbench and it's nothing but a rest query we are going to execute here we can see what other things happened.
Okay, let me go to this dashboard. Let me integrate and dynamically, okay, now you see here all one on rest calls. Okay, if you see this limit? Yeah, I'm coming there, okay. Okay. So if you see this limits, for example, how many API requests I have made, okay, total allowed this much and I have already used this one already used and remaining this month.
So from here you can see how many people I met. Okay, and if you see here, let's see how many a singular suffix I have. I will do. My total limit is this is it and how many I've used and how many lifted it's completely on my audible Okay. So, this future call or this you better pick social graphics everything falls under this as simple as execution. Yeah, there are for example, many applications right in build application and that is a managed package for example, now, these manage package also calling and call out because we are getting some data from the third party.
So, in this scenario, we want to see that how many which one is making more calls. So, how we can find out then if it is not required, then we can just take it out that application if it is making more calls, so, is there have something where we can see or according to the application and according to the all users No need to go particular user and activate the debug log. I want to you know, see what happened here. In this limits in digital timber, my limits imposed by self first to my account, limit my application, okay for my system. So now whenever a widget manager is that limits and not being considered my limit, okay, because all the manufacturers are being reviewed by the Salesforce and then it's come to the topics in the app then you use it. So, if you have a specific transactions, see this issue comes basically if you go into cross the limit, then Salesforce will stop you okay you are already considering many, many companies.
So now what happened here whenever humanistic as their manager gets everything you own in a separate transaction, okay, not in the same transaction. Okay, so, you cannot segregate all without putting a debug log, how many calls you made from application tab reputation acts of habit evolutionary. And if you want to check that, then you have to pull the blow you're on the Atlantic, sometimes you can see how many Any call outs or harming a single API call or a synchronous ignition limit you have used called that innocence. Okay. So everything comes let me let me show you this you know if you put debug log then only you can see that but otherwise you cannot see it let me show you what I'm trying to see here. There are going to create one account quickly just to see the logs or I can go on to an accountant speak and we can see what are the logs I have no let me know when you develop.
You can see here number of follow me Okay, it's always depending on the connections. Okay? So in Atlanta some scenes right now I don't have any other managers, it's from my own instance, limit users for the whole universe because the default instance so this this part can, if any manufacturers code being invoked from these transactions, then we'll get on to another section. Okay? limit you just pour the anestis every minute because comes with an extra s. AP US, let's see booking bug as your manage package or you will use any project management tool manage package that's being invoked, then that limit will be separate limit completely for you. It will not consider under this limit, okay.
It will have another limit, you can see limit you just for namespace and so forth. Then aquatics and so Yes, ma'am. Okay, but you cannot do any reporting on there directly, okay. In the system, witness per second, how many of you a call for this trestles Okay, so you can See on this debug level okay or you can go to workbench you can see from this way the displays in that way nothing more you can do on on there, but my mind So, particularly per user we can see just individual user we can see and the organizational limit that sir that on our level we can see from here. So, you cannot do a secondary report on this okay what you can do, you can use the limit class let me show you the limit class, what we can do is a limit class this class we will use whenever writing the program associate for everything that you want to live in.
So transferwise how many how much I have on how much I have used on the laptop for me. So, like, how many DML statements I can think is good, and let's see, I have already deleted 10 DML statements in my transactions. So, how many have used on how many pending hurry so, all the methods see how many call outs you have no returns the number of oil service statements that have been processed, okay how many I think also email everything we got from the premier if you see all these methods we have which we can use to get it. So let's see if you go to these get limited keynote, okay. So, total number of motion assessment that can be processed. So, out of the limit, I will know how many limits call out I can make more this type of millimeter you can use to control it.
Okay, but you cannot get it for totally how many already used for a specific nefarious or string managed package with all manifests posted on in a political sense not comes in the sentences, but they are limited will be under that nurses who is not going to impact our limit. So let's see here. My number of DML statement is zero for the program manager is there may be A DML statement. So, that is not going to increase this limit here for that that will have the separate limit okay. So, we can see overly on the org level how much we have used here you know what went this way okay confused good idea a little confused okay see all your questions straight I can see you cannot segregate Okay. That way if you have five named pipe manufacturers you have used then you cannot segregate, which manufacturers use how many calls.
So, these call out or everything controlled transaction wise. So, we are not going to use without a try without an if there is no transaction on my system. If nobody logged into my system, then there is nothing who can do with the columns. Okay. So the call outs or maybe any limits what we have everything starts with a transactions. So, if there is no transaction there is nothing to do okay the moment transactions happen happen then the availability of the resource on how much I have used on these transactions and then we go for it and to check that nurses being used how many times you have to use only the debug log, okay then you can see till the time you don't put debug log, you cannot assess what is happening in a system.
Secondly, overall if you want to see in completely on my system, what happened, then you can go and use this limits. Okay, so what we have here, here, go to the rest Explorer. This is the overall in the system. Okay, how much we have used totally. Let's see, go to this utilities rush for. There's no good men you can see all type of response We can see and we can get it from here.
Eliminate licensing everything, okay? not specific to any namespace we have here. Okay? It's like overall what happened and speak to namespace you can get only by the logs. Okay? So it's all about the things con things manage correct transactions, okay?
So all the transactions what we have used in my system I have millions of transactions I'm doing all the transaction cumulatively source here, whatever the resource I've used and how many times I've used in that way. Okay, you can see all all tables in Word licensing everything whatever you want. Anyway, anyway, we'll see if or Wow, or what we can do, we can customize the using method IPA. Okay, that is our thing. Our one stop method IPA you can use to control what we can do at IPR, tooling, EPA, but straightforward. We don't have anything like that.
Okay, this namespace used this many resource for you right now in a senior system completely, but transaction wise you can get from the logs. That was only we can do. Okay. Okay. Yeah, for new debug one way one will really understand more of what is happening display media and how we're going to live it but Okay, so now whenever I'm going to talk about this future method, okay, so I want to write the sources speak piece of code in a future method. So let's see this future this piece of logic, but I have, I want to write in pewter metal.
So what do we do here? We will write one class, and we want to convert that class as a future class. So what we'll do here, okay, so this is my class name. I want to write a method. Let's see, I will tell for understanding or deciding the name the equalization method you can give any name till now You can see this class nothing, but it's a simple class one. Like any class, now, how can I say, in this class, there is a future method.
Let's see, I just wrote a few line of logic in this place. Okay? Some of the guy that I wrote which may take a long time to process so I'm just writing some some piece of logic. So like this, I may have the mainland support okay. So but still is he this class nothing but a normal English class. So how this class can be a future class.
So can be future method. Okay? So this methodically situation normal method, the moment you want to make any method as a future method. So let's see this class what I have, okay, I want to invoke this logic in our country. For example, I'm just going to open the account record right now on my system. Or we have it in some of our countries or if you see a country that I have.
So all the logics have written something quite simple. And let's see, I'm just going to write one class which we call account feature okay.my method name I have as future method. I'm just going to invoke this. Okay? So now it's possible to instead of these three lines have for several lines of code I have, instead of keeping directly on this place, because it's going to take a long time to process I prefer to make it as separate transitions using a pitcher method. So now he pentameter I just made a call.
So now if you see this class, nothing but a normal class. So how this method is going to run in backend or how this method is going to run in future. Okay, initial transforms to make any method as a future method. What do you have to do? You have to write the annotation all the understand in Salesforce is starting with Android. And what is the understand for this generation of ember feature?
The moment you see any number any class method, if there is a under some colored creature, then Salesforce understands this method logic native Iran in back end, a synchronous mode. Okay? So you'd say future call for me okay. So whenever you're writing a feature method, so, there are some kind of consideration you have to think the past one to listen the method what is honored with future should be a static method, because I am going to running this logic in a synchronous mode are separate transactions. So, I don't know I don't need to have an object whenever a thread object we are let's see, if I want to call this future method not as a static, what do you have do? You have to create one object on this plus character account?
Let's see a prequel to new account feature. Then you go to F dot Future method Okay. Now the moment you write this line, so, in the same transaction So, this particular sheet for this education we have created one hip memory let's see, we have grown hip memory and here all the variables all the objects all the declare some pointer I have everything allocating some memory here. So now on the moment I have written this account future if equal new account features nothing but I'm creating a new object a new instance. So that allocating some memory here, okay. Now, if this memory is there, but my future method may take a dramatic execution time, more than the time I need to consume these synchronous operations, it may happen mind resolution completed, but till that time, my future method is usually not completed.
So once the process complete, that result is complete, then this memory He's going to be erased from the system. So, now everything is for the object what I have created then that object is not going to not having any memory loss in the system, there is no difference. So now what happened whenever you write a future method, always remember that methods will be static. So we are not going to allocate any memory for that object. So simply I can invoke the methods using the class name class name dot future method. Okay.
So, password and remember, the methods we'll be starting with are always Okay, so if anytime you read anything as a future, this should be static. See, now I said I will lose me. And assuming let me say it, but let's see I didn't see pages static and just having it See, certain future method must be declared as static. So remember, list. Future muscle means you should make this as a static. Okay, our second thing so future method Once in a synchronous mode, so now I invoke the method to execute.
And I am not waiting for the output of that. So now let's see from this line of code. So here I have written some line of code. And here I do one future method. Okay, now, I invoke this logic, but I didn't do it I continue to do so. Okay, so as my invocation point is here, say it let's let's consider stick to millisecond time execution Okay.
Now, I continue to make Jewson in two millisecond I came up to this place. So now, if I return the output from this method method logic returns something here it will go normally from where this method being in public will go to there will come here, but here my equation completed. So always remember my ignition came to somewhere somewhere here because this part of logic in ticketing in a synchronous mode in separately. So for that reason you if you have a In future contribution, then output always should be or return they always should be okay. So, whenever you write a future method you remember it should be a static wire and the method name okay. So, in a technical way say the method the future methods should be static with return type should be static and returns a pointer, then you can add any logic here to process it Okay.
And then it says method inside this I can pass on parameter. Let's see I say integer number one and maybe string name. The moment I am saying okay it can't a parameter then what type of parameter it can take. Okay, these particular each pass when you remember it, which I think you should reward, okay, and the parameter when you say for the future method, so it is going to have primitive type of rotation when I say primitive type or or tape, it is nothing but I can say like integer okay like string all these artists who can take a Boolean that kind of writer can take okay apart from that what more I can take I can take ri are my colleagues entail okay are my colleagues and when I say Collison the word my lease it and a map and the collision of what kinetic collision of any as object or collision activity.
So let let me show you now see I said I was able to share this, this method in this class. But now let's see, I'm just going to take one list of accounts. So, the moment I tried to list a call let me save you save this class. Let's see what happened. See Peter method doesn't support parameter type list. An initial list of account he paypass a list of integers.
Let's see it The analysis he tried to save so now I will receive so from this cannot conclude it can take only the IRA or collection of primitive types so as object type of primitive okay yes object type for collection we cannot pass as a parameter to a future method okay okay then let's see I want to pass one a subject that it did not occur listen just one a subject can I save it when it tried to save this what happened here. So, see future method does not support parameter Tiger barcode. So, that means I cannot pass a parameter as a subject okay. It cannot be a condition of a subject or a single method. So whenever you write a future method, which is going to run in background as a synchronous operations, each sould be unrelated with a future method. So, future annotations The methods should be static with written as point and parameter can be primitive take or array or collection of primitive types, we cannot pass any s object or we cannot pass the collection of a subject as a parameter to the future method.
Okay, so now we'll think why you entered passing yes object as a parameter. Why it's not alone? Anybody can answer assuming the one question may come Why you are not able to pass a subject as a parameter. Okay, let me see you. So now, from this place, I have invoked this. Let's consider I have passed my icon list.
Displace, okay, and then after this or not this this land code like our users knew. Okay, I just passed here. Let's consider my trigger dot new on displace. Let's consider Shall I just pass it after that I can write for count sec triggered new. And then I can invoke some logic or glitzy now, I'll go on I'll change sec dot tie equal to, let's see. Let's do some database and commercial.
Okay. So now then I multiple other logics. So now see, whenever I pass this trigger knew nothing but we are commonly used to this visual method that 10 consider my account typos Industrial. Ok. So in this place the method, my account type is nothing but industrial. And the solution we're going to take four millisecond time to execute, for example, and this is going to in between that before my future method ignition completed, my logic may come to here to address this in turn smart.
So now, I manipulate the data data to commercial. So what data pass to a dude, and then I'm modifying that. So only for the German a survey data may change before my future regulation completed. So we don't allow any future method to take any subject type as a parameters. Okay, so let's see, we'll write one small piece of code. And we'll see what happened.
Let's see in the future method. I'm just going to Night one piece of logic here, just the system to debug and put in nothing is any kind of logic and write whatever you want to include. Inside pitiful. I just save it. Let's see, I'm going to write another trigger, maybe on the content emulating triggers. Just I'll show you how I invoke my future method.
By go here, contact. I go here trigger. I'm just writing cookie one trigger, just to invert that. Let's have a look. Give the trigger name is contact trigger. lesson here I'm just putting up before insert.
Okay, so now I'm just going to make on future dot and I'm going to pass any parameters right from here. Oh, we understood, okay, we can calculate the familiar type of parameters or collection of primitive types. Right now I'm not passing anything. Simply I'm just showing how I can invoke a future call from an image. I just refer to that I'm just writing a debug statement and show you this from the debug contact record invoked. Okay, and then everything and contact record completed.
Okay, we'll see what happened. I said, the report insert or you will have some more logic, but some part of logic I want to do in future future method. So I create a class with a method on future, which is static and void. And I have written my logic here. So then I invoke that part as a normal method call in my trigger. Okay, now I go, let me save it quickly.
Now we'll go to a contact. I go to contact here. So now I'm going to do it. I just click New before insert, I'm doing something. Let's see I just kept nameless new content I just said, Okay. So the moment I said it So, my thousand stats something happened.
So, if I go to my debug log so now that 20% So, now see, for the average essence, we used to get one entry here. So, see I have an entry separate a separate entry for Twitter handle and one entry for main contacted. So, you pay go open this to debug look past them opening contact edit debug log okay. So, now see, I got my contact record invoked, then I got my contact record completed. So, as from this contact record, I have been booked this past time in my designing router contacted in book then this line in book. So this is called my pitcher method.
So I should come here, account hitter method, then I should print this line, then I should go to my next line. But if you see these line created completely separate transactions, I mean, if you go here see line number two in line number three invoke one feature call, then contact record completed, okay. You see now, I have a number of future calls one out of 50 support transactions I can use 15 number of future cons. So, out of 50 I have made one feature come here okay. So, then what happened to feature metal what I have now? So, for that it is create a separate Tennyson's.
So, you see, if you go to these, all the divisions starts from here to here. So, now, I got the book insert which will come and see the color limit here Judo I you need. So, each time each time if you see the number of call outs in the future call reset to Judo, but whenever in the contract triggered the number of call outs Each one so in number of future college one okay, but in this place you see number of future college zero okay. So, now when this is a future call what happened here it is added to the queue to execute or not So, totally how many we can keep in this we can make two we can make one job to be in the queue okay all the limited all the limits of I have everything God we should. So, both God in both operations became in this particular instance okay.
But this way I can invoke my future to envelop Israel for nothing but we just call that method with this class then I did study method. So, class name.my method Now, what I have used on displace, okay right now, I have just one debug line what you can write many lines of complex logic here to process it working fine now Any question any confusion? So we write future methods for running the jobs in the background. That is the only purpose for writing the future methods. Yes. So let's, let me tell you where what are the one ideal scenario, okay?
I'm handling that many times. Okay, then why I need to come to this type of scenario. Okay. Let's see. You have your logic to write. Let's see.
We're going to create one record on opportunity. Okay, so on the creation of a new opportunity. So what do you do? We go and add the product on onto that. So we just had some product to this opportunity. Okay.
So now the woman did it perfect opportunity. So from the inventory, so let's see in the in the in the total inventory I have I will put 100 Okay. So now what happened here? So right now, we have created many opportunity and are disparate and we are already used 90. Now we are remaining 10 Okay, so I have a logic here. If my inventory count of this product decreased to less than five, then I will send one email to let's multiple people sending this email.
Okay. And before to send this email, I will have some complex logic to chickens. Okay, so I'm referring these to handle in the code. So to send an email to inventory. I am not defending anything to my current technology. Okay, so after insert of the line items to me or ports 20 I will just send an email to some third party peoples who are managing my inventory.
So this logic can make make as a background job Can I hold on I think other separate transactions Okay, so whatever these Send Email functionality what I'll have I want this to run as a background job I don't want this this journey will personally not depending anything on my current pet, okay, I understood okay whenever this logic no whenever my inventory count less than hype with some other conditions, then I just refer a girl send some notification to some other property peoples who are going to order the new birds from some areas. Okay, so that thing, this animal personalty We can write as a future method. Okay? So it is not going to consume anything from my current traditional language. Okay? the sending of the email may take one second may take a second medic primary no matter so right now if my inventory count less than time high It doesn't mean okay I'll send my email immediately and get my inventory Arabic numerals okay it may take me 2% or five minute process or maybe a millisecond to process no matter for me.
So I prefer these to write as a background job. Whenever you want that then simply we can go and we can write a Send Email functionality as a future method which can be invoked on my trigger logic or somewhere I can invoke this one. Okay, this way we use normal decision makers. Okay. Or it may happen instead of saying email. I just want to habits and SMS okay.
So now, I'm going to do this in SMS. So from Salesforce, there is no logic where I can send SMS directly to any mobile number. So we may use some third party tool, okay, it may be SMS country or any tool, which your organization prefers to invoke this type of logic from my trigger. Okay, what I can do, so whenever I want to invoke these third party, some is nothing but a web service integration for me right now, whenever I'm doing this one, whenever I do this one, so I can do a future call out from my trigger, okay. Like, if you remember, I said, it should be unlimited with future. Wait, call out equals true.
So when you invoke these, then I understood Okay, I need to send some data to my third party application, who is going to send SMS to some specified mobile numbers. Okay, so who is You want this one to send an SMS from my system to somewhere I can run it as a background jobs then why do I need to use my own limits EPC This limits the debug limit the debug log limit whatever I file use my current limits here. So why don't I prefer to use as a future method? Got my point. So, there are many scenarios, you can go and write this repeater method Okay. Any confusion Tell me.
So, can we say that the email alert which we get from the workflow rules can they be considered as future future outlook functionality for us, okay. So, that is internally handled by sulfurous It may be a future method for them, but that are counting in our outreach systems. Let me show you if you have any workflow now then we will see the lines here it will go in the same trances okay. Okay that pattern will get clarity when you talk about the trigger ignition flow, I'll tell but that will come here, but for example, what is it it can be a future call also okay. So, just in case if there is any any logic or any process which is going to consume a lot of time for you, okay that part you can convert p p tomorrow. Again, we can have 50 who just call out in a singleton instance.
But there is a limitation in the future. Okay. You cannot make the nested future calls. Let's see, I invoke on transactions Okay, and publisher sometime very future call okay. And from inside this special call, I want to make another feature call it will system will fail on this part. Okay.
So to overcome this, we came i j i think john Singleton sorry, I'm sorry, we came at a cable job. Okay. I'll say what is this cable job and how we can use this. So it seems like you have been you've been confused today is it tell me if you ask many questions then all the clutter. doubt you will feel you will not ask questions and I will be the Ashwini Yeah. Sea Don't be confused.
Okay. Everything okay. So, simply remember future call number if you have a long time running process okay which can be handled in the backend okay which can be who whose logic processing takes a long time and the outcome of that logic you are not going to use in the current Renaissance then that part you can convert to a pewter method which can run as a background and technically whenever you write a future class, so, in future method, it should be a static and it doesn't have to be boiled or parameter can be a primitive type or a collection of primitives right? You should refer to a future keyword and read feature that much and then the logic you can write whatever you want. Okay, let me show you some example. So, right now here simply okay, but but the, we'll discuss about variable job, which is the advanced version of the pitcher method.
Go to this type of a console I see what I'm talking everything we everything can see your future methods launch in the background as synchronously we can call it a method for getting long running your presence like your service call or anything. So, this is the syntax of the writing the future call okay. So you can it any any logic here you can process the records okay it might take some time so maybe quickly okay for those books service call you want to make these future call record true okay. For example, what happened here if you if you write a future call here Okay. Let's you are going to manipulate something here okay. So that that pattern so mathematically methods can be invoked for Transamerica triple A, then this testing everything I will come in the Nexus on the best practices and combinations okay.
So just very simple thing okay. But I will tell you more. Nevertheless, I will tell you what this QA will appreciate is more than this You will have this cumulative 1800 but you understand this just simply to understand how did you make widget plus Okay, it's quite simple if you want me to write a complete program on it, but I just want to show you the invocation on how to write so I just wrote it sample logic here, okay? Then if you want okay I want to process millions of accounts. So simply what you can do there is I go and process all the account here. Okay.
So write your query count let you manipulate your own logic you just process all your account here like account in Excel, okay? then voila, you want to conduct all the logic here. And in any number of lines, you can do it you can protect your call the business department here, it may be you want okay for these all accounts for clipping here, okay, print the account, you have an email field. Let's take all the all the email field, the email said dot art, let's control ACC dot, email underscore See, we got all the email fields, okay? Then you just configure single email message object, they will write some piece of logic here, okay to build email code, okay, then send email. So in the now connected, I'm going to send an email to my hundred account contacts, account emails.
So now to send an email to 100 accounts it may take some time. Okay, so now instead of this logic writing directly on my trigger here, trigger here. So I want to run it by background jobs simply I can make it as a future method to send these emails I don't worry anything else wants my code inserted, or one click on something else. And I'll just send this email to my account email addresses That way. So, this piece of logic I made eligible to make a critical just renewed this feature, starting word and parameter you can pass out unit then the logical to you and to call this when you're nothing just classname my method name, my class name is account feature you can give any name and this method Got it? Yes.
You have to practice and see do you think will come under scenario when you work like I said two scenarios like sending the email or SMS SMS or email processing logic also and sometime What happened? Let me tell you one one example. So, if you work in terminate big, big, big big org, or big applications, so my one channel exams Okay, may consume hundred so we'll make a joke. Okay. I want to break okay. I don't want to use all 100 as a single single time.
So I want to break it into. So I can segregate the logic, some logic to a future con, the moment I make a future call. So the logic whatever is in a future call will drawn in a separator in essence, the moment I do it separate functions, then I can handle my so called limit here. Okay, in that but also us because he will practice and we'll got more and more ideas about this. As we learn what it is to Joker and how to write it, then we'll see. So do one thing for your learning.
When you tomorrow go to a piece, you just see where you have a method called with under feature. So if you anytime didn't use one, one, Chrome extensions, okay, let me show you. I don't know if you're using or not, but it's very good, very good one. So there is a Chrome extension we use. Okay, this one For searchers here it is you don't get always okay if he returns extension then you'll get it so let's see I'll just go on search like future okay. So in the class pay to go wherever he wants the future will write only in the class so just the class checkbox click on Go it will search all over your system to find out wherever the class with future written in that will get it okay you just go and see what are the classes you have mentioned in a future Okay.
See this method okay this is a method we have created method then go again and such that here now now you can see why that comprehend what are the logic you can get Okay, in which class or which mental we have used it. Let's see, I will trigger I'll get it and that is in the conductor. So now you can see what are the critical points you have Okay, here I am a future call. Then you can go on see okay in the future call. What logical alternative? Just one, check one Don't miss it.
Okay, when you go tomorrow past what you do it, do you have any future call written in your if it is in a particular gene you can insert that and from where it is being invoked. So will it not come under effects job list? future jobs? Correct. Very nice question. Let me go there so now, we'll see it comes in not late, I'll just scroll down to measures.
We have this under my industry observes. If you go here, see I just go to the suffix jobs. I got a job title future or the classroom upon future. Okay. So let's see. I don't know where where else comes that I'll go to city jobs.
It is not a city worker. So it's not their jobs comes I Tyco future. Let's see I go to my office flex view. I think it is So let's see I go to background jobs here this is also this is nothing but my report Iran or my chakra digest all you want to import as football data all will come here so whenever you say future everything you can see on graphics job with Tigers future or type elements or type which will epics whatever you want okay so all the assemblers, jobs, whatever you have in system everything comes here. Okay, so for future jobs the job type will be future like that's how they will up. Yes.
Okay. Okay. Perfect. So that here as well we can check that where future jobs are being used. Yes, you can see what are the jobs we have? You have a second transaction okay.
So for this instance, one future window even matters and I have gone to future and to ensure we'll be there okay. So what more you can do like it like here, you can query so it's nothing but C number of future calls so you have your period. So you what you can do here let me go you can create a new view here. Let's see I can say future job title equals future. Okay, now what parameters I can do it job day shutters when processed Everything okay? So you can just say which so it also only the vision wizard.
Okay but again, again it's not to a specific package everything you can get here. So that is nothing but the number of calls for do we have in this place? This is Sam Sam part, you can get it also. Let me show you the limits here as an Excel This will count to cool fundamentals whatever Okay, so anyways you can do and also if you want by object level if you want to see so anyways we have politicizing epic jobs so heroes have job third selected let me agree to one second and I just kept your job tie. Teacher wonderful. Okay.
So nothing but the same thing we gave it I think what do we see? You can use VNC programmatically also okay. So do one thing check this future implementation if you have anything you know in your application you can try to understand what is the logic see logically same thing declare some variable right some query manipulated okay then see how this issue is being invoked from which class or will trigger okay. Clear versus Yes. Okay. asuni not so clear what I will practice.
Yes, you will use in the past to quote what happened. So, technically, pitcher pitcher pitcher method is just to learn in school. You have to write it around a distant future. And they have to be your method a static and return type void on the parameter paths of the collection of an activity. Or representative a subject not alone insert future method as a parameter then invoke that as a method class name dot method now, as you see something different okay? So for implement isn't as a search an email or anything so you see in your what is the logic you have it in there.
Try to see that okay then then you can get it and all the jobs story as a picture. Okay of the table features. Okay, then we'll meet in the next session, we'll go We'll see what is your capabilities? Or what is your best practices for this epic stuff. So, further up future method, report limitations we have on this Okay, all okay. Okay, thank you.
Thank you so much. Have a nice day. In addition, thank you, you