 Hello everyone. In this module, I'm going to demonstrate how to call Apex class methods in Aura components. So let's jump into developer console. So in this demonstration, we need to implement two things. One is Aura component and another one is controller Apex controller. So Apex controller will be part of server and our component like will be part of client side. So we need to pass the data of S object through Apex controller. So let's first create Apex controller. So I'm naming it as account controller. So whenever you create any Apex class that you will be linking with your Aura component. So if you implement any method in that class and if you are calling that method in the Aura component. So you need to use one annotation that is Aura enabled. If method is Aura enabled then only they will be called in the Aura component otherwise not. Then public static void not void list of account. So it will be returning list of account and naming it as get account. Right. Then I'm creating list of account ACC list equals to new list of account. Then ACC list equals to select ID name from account and limit 10. So this is the where clause not where clause it is a limit. So only 10 records will be queried and they will be available in this ACC list. And after that I'm writing return ACC list. Right. So this way I implemented this account controller which is basically Apex controller and this Apex controller we can call in the Aura component. So whatever value it will be returning so we can render those values in the Aura component or we can use these values for any calculation in the Aura component. So now I'm going to create new lightning component and naming it as account LC account lightning component and clicking on submit. Now in this component we need to create the view of this lightning component like what should be rendered on the UI. So first time creating one attribute its name will be ACC list and type will be list. So in one of the previous module I demonstrated like how we can create list. So here we are creating list its name will be ACC list then or a handler name in it. So in it also be used in previous modules then in this unit we need to provide value and action. So action is C dot doing it. So this is a handler whenever component loads this handler automatically calls a method which is available in this action. So we need to define this doing it function so that whatever task you want to perform on load of this component can be executed. Now after this I'm creating lightning select so this will be a drop down. So we are you can select particular value so naming it as select one labeling it as select an account right inside this lightning select I need to provide some options. So first option will be none so value of this will be null and label will be displayed as none. Now this ACC list is a list which will contain more than one account records right so we need to iterate on this. So in this module first time we will be using iteration in order component. So if you want to apply iteration in order component so you need to use order column iteration then items equals to and here you can pass that list. So you need to use V exclamation be dot ACC list so here it is known as collection and to iterate it one by one so we need to create this variable as well. So it is kind of for each so we are iterating on this ACC list with the help of this items equals to and one by one each account will be available in this item. So now we need to use this item. So here I'm writing option value equals to item dot ID because through this controller we are receiving ID and name so those will be available here as well. So item dot ID closing this and here item dot name. So item dot name will be a label and if you select that particular item or like name account name so for internal process it's ID will be used. So this is the idea behind this now the moving these spaces saving this code right so this way I implemented this UI part so a drop down will be available where multiple account records will be rendered. And if you select particular account so that accounts ID will be used as a value for further calculations. Right, so now we need to define doing it function so that on load whatever default operation we want to perform that can be executed. So default operation what we need to do, like we need to link that a picks controller, so that we can call that method so now we need to do one more thing. In this component. So here I need to write controller equals to account controller. So now, if you want to link this apex controller with your lightning component so you need to write the statement. If you write the statement then only you will be able to call the methods which are available in this class. Okay, so name is incorrect. Now it is perfectly fine and it is saved. Right, so I hope you understood how we can link lightning component with this apex controller so you need to remember this, if it is not mentioned here. It is like runtime error so you will be debugging your code and it is difficult to find like you forgot to write this. So, in initial like implementation you need to write this so that you won't put yourself in trouble. Right, so let's now implement the controller part so that we can have the doing it. So I am clicking on this controller, renaming it as do in it and here we need to call the method of that account controller class. So creating one variable named as action component dot get. Now in double quotes you need to write C dot get accounts. So remember. Remember we use this C dot to call functions of this JavaScript controller with exclamation sign. But in this controller, if you want to call a picks controller methods a picks controller means like this account controller. If you want to call this get accounts method. So then also you need to use this C dot but here exclamation is not required. So I am adding C dot get accounts. Now action dot set call back this comma function response. So response will be available in this response. So here I'm writing variable state equals to response dot get state and then if state triple equals to success. So if you are successfully able to call that method and you received some response. So this if condition will be true. Now the result is available in this response and we need to store that result into this ACC list that we created here. So how we can do that. So we need to write component dot set V dot ACC list and response dot get return value. Right. So this way, the returned value will be assigned into this ACC list and we are returning a countless. So it will be automatically stored in this. And here we need to end it. Now, we need to use one more statement dollar a dot and you action and action. So this is a global action and if you don't write this, then your this complete action won't be executed. Right. So what we did, first we call this method, which is part of that apex controller, its information will be available into action we are attaching or like we are calling set call back method, and we are doing this operation and then we are passing this action into this and this action. So all together it will be executed and the result will be available on the UI, so that you can execute that. So, I hope you understood how I implemented all these things so I implemented three things. First is a picks controller second components view and then components controller. So we need to open a demo application so that we can render this so account lightning component we need to render. So I'm saving this clicking on preview. So it's loading. So here you can see select an account masses available. Initially it is showing none. And if I click here, so it is showing 10 accounts name. And as a label if I select any account. So internally it's ID will be automatically like selected here. And this you can use for further calculation. So, this way, I demonstrated you like how we can link a picks controller with the lightning component and now whatever changes you make in this apex controller that will automatically reflect to your lightning component. So let's say if I change it to five. And if I don't make any change in the lightning component, so it will be available with your component so only five accounts are displayed. Right, so controller is available at server side it is interacting with your s object. It will return the values and accordingly you can do processing on your data. So I hope this way you understood like how we can call a picks last method so this way we can connect apex controller with lightning component which is implemented using aura. So this is all about how to call a picks class methods. Thank you.