function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akhil Katkam 5Akhil Katkam 5 

why apex is not calling from controller method

Hi Developer Community, 

I was not able to find why my apex is not calling from controller method ,

can anyone please tell me the reason for this
Suraj Tripathi 47Suraj Tripathi 47
Hi Akhil,

Greetings!

Maybe the syntax you are using is not correct.

If you are using in Lighting Component, Refer to this-
http://amitsalesforce.blogspot.com/2018/08/invoke-apex-from-lightning-component.html

and If you are using Lightning Web Component (LWC), refer to this-
https://www.sfdcblogs.com/post/call-apex-from-lwc

Please mark it as the best answer if it helps you to fix the issue.

Thank you!

Regards,
Suraj Tripathi
Akhil Katkam 5Akhil Katkam 5
Hi Suraj , 

Thanks for the response , 

please check my code below 


request1 :  function(component, event, helper) {
            var recId = component.get("v.selectedId");
            alert('hi');
         //   var recordId =component.get("v.recordId");
            var action = component.get("c.fetchCompetitions");
              action.setParams({
            "recordId" : component.get("v.recordId"),
                  "recId" : recId
                             
        });
            $A.enqueueAction(action);
}
mukesh guptamukesh gupta
Hi Akhil,

CAn you please share you component (.cmp) file code, that's would be eaisr to trace the issue.

if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh