Hi I have a problem with passing parameter into apex class. I need to pass there field value from object. This value is hidden and its not showing anywhere in component, its only saved in database.

    deleteTemporaryTransaction : function(cmp, event){
        var action = cmp.get("c.deleteTempTransactions");
        cmp.set("v.data", []);

//how to add value HERE
({klipId : *value here* });

        action.setCallback(this, function (actionResult) {

        console.log("delete temp");
  • Can you explain more this:- I need to pass their field value from the object. This value is hidden and it is not showing anywhere in the component, its only saved in the database? – sanket kumar Sep 7 '18 at 13:13
  • I have a object, where are many custom fields. I have an aura iterator which is showing me data. When i want to delete on button click, i need to pass specific value of one field there. For example i have field "CaseId__c" and i want to usite like this action.setParams ({klipId : {!data.CaseId__c }); – David Sep 7 '18 at 13:24

You can pass the argument value in your apex controller through Client side controller as follows:-

    handClick : function(component, event, helper) {

         var ObjectWith5Fields = component.get("v.candidate");
        var action = component.get("c.saveRecord");
            "cand" : ObjectWith5Fields
        action.setCallback(this, function(response) {
            var state = response.getState();
            if( state === "SUCCESS") {
                alert("hello from here");
        } );

Here, I am getting the Object value using

var ObjectWith5Fields = component.get("v.candidate");

and then calling the apex method as:-

var action = component.get("c.saveRecord");

and setting the value of argument using

action.setParams({ "cand" : ObjectWith5Fields });

And, Here is my apex Controller:-

public with sharing class SampleAppController {

    public static void saveRecord(Candidate__c cand){
        if(cand!= null){
            insert cand;
        System.debug('candidate is-->>' + cand);


If you want to use it like this action.setParams ({klipId : {!data.CaseId__c });

After getting the object value from Component, what you need is set as follows:-

            "klipId " : ObjectWith5Fields.CaseId__c 

here ObjectWith5Fields is the variable to store the object value, as you can see in Controller code.

  • Hi thanks for tip, i used it like this deleteTemporaryTransaction : function(cmp){ var claimedTransData = cmp.get("v.data"); var action = cmp.get("c.deleteTempTransactions"); action.setParams( {"klipId" : claimedTransData.KLIP_Subcase} ); console.log(claimedTransData.KLIP_Subcase__c); $A.enqueueAction(action); console.log("delete temp"); } but its still "undefined" – David Sep 10 '18 at 7:17
  • Does it solve your problem? – sanket kumar Sep 10 '18 at 7:30
  • no, its still passing undefined value – David Sep 10 '18 at 7:44
  • Update your question with what you are actually trying to achieve and component code snippet. I want to look at that and then suggest you. – sanket kumar Sep 10 '18 at 7:47
  • No its working fine now, your answer was useful. I had a typo in code. – David Sep 10 '18 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.