I am facing a weird issue of Salesforce calling infinite times the Server side Action from the Lightning component. Has anyone faced a similar issue?

I am pasting the code for your reference.

<lightning:button variant="brand" label="Save" title="Save" onclick="{!c.saveProductToQuote}"/>

The Javascript controller for the same :

saveProductToQuote : function(component, event, helper) {
    //alert('Inside saveProductToQuote');
    helper.saveProductToQuote(component, event, helper); 

The Javascript Helper is :

saveProductToQuote : function(component, event, helper) {
    var action = component.get("c.saveProductToQuote");
    var prod = JSON.stringify(component.get("v.selectedPrdRec"));
    console.log('Inside the Helper'+JSON.stringify(prod));
        "prod" : prod
        //get the response state
        var state = a.getState();
        //check if result is successfull
        if(state == "SUCCESS"){
            var result = a.getReturnValue();
        } else if(state == "ERROR"){
            alert('Error in calling server side action');

And the Apex controller Method is :

public static boolean saveProductToQuote(String prod){
    return true;

The two console.log statements in the Helper prints the details infinitely and my browser crashes. And no Apex debug log for calling server side action is logged.

Thanks for the help.


1 Answer 1


The server side and client side controller method names should be different. change the name of server side method saveProductToQuote

From documentation

Use unique names for client-side and server-side actions in a component. A JavaScript function (client-side action) with the same name as an Apex method (server-side action ) can lead to hard-to-debug issues. In debug mode, the framework logs a browser console warning about the clashing client-side and server-side action names.

  • Hi @RedDevil Thanks a lot, I don't know how I missed sighting the issue of naming both the Apex Method name and Helper name same. Commented Jun 6, 2018 at 7:25
  • No worries. Happy to help!
    – RedDevil
    Commented Jun 6, 2018 at 7:26
  • 2
    @RedDevil helper method names and server side name can be same it don't cause any issues.only component controller name and apex method name should be different.
    – vignesh
    Commented Jun 6, 2018 at 7:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .