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
Sergio Mac IntoshSergio Mac Intosh 

How can i pass attributes when calling an apex class

I got this lightning method which calls the apex class 'getProducts'. Now i would like to call a apex class which needs an attribute.
How can i do this?
getMyObjects: function(cmp){
    var action = cmp.get("c.getProducts");
    action.setCallback(this, function(response){
        var state = response.getState();
        if (state === "SUCCESS") {
            cmp.set("v.myObjects", response.getReturnValue());
        }
    });
    $A.enqueueAction(action);
    }

 
Best Answer chosen by Sergio Mac Intosh
sfdcMonkey.comsfdcMonkey.com
hi Sergio Mac Intosh
use action.setParams(); method for set attribute on apex class from component
go to below link for example
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_actions_call.htm
Mark it best answer if it helps you so it makr peroper solution for others in future :)
Thnaks