You need to sign in to do that
Don't have an account?
sfdc_beginner7
How can we pass multiple parameters from Component to Apex class?
How can we pass multiple parameters from Component to Apex class .For ex I have a custom object ObjectA__c , the component takes input from user and then I need to process these values in apex class and save to db . There are more than 10 fields which needs which needs to be set in apex. I cant pass these fields as parameters . I am not sure about wrapper class. Please let me know what is the best way to do it .
Which component are you using,
Apex Components
Aura Components
LWC Components
Regards,
Soyab
Use force:recordData and send multiple parameter from lightning component to apex class using targetFields.
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="FULL"
targetRecord="{!v.recordInfo}"
targetFields="{!v.ObjectA__c_Object }"
/>
Click on the below link for more explain:
https://developer.salesforce.com/docs/component-library/bundle/force:recordData/documentation
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
var action = component.get("c.saveAccounts");
action.setParams({
"value1": JSON.stringify(component.get("v.value1"),
"value2": JSON.stringify(component.get("v.value2"),
"value3": JSON.stringify(component.get("v.value3"),
});
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
}