So i have one function which makes an apex call

     doInit: function(component, event, helper) {
                       var Opptype =  component.get("v.simpleRecord.Type_Of_Opportunity__c");
     var action = component.get("c.getRecordTypeName");
                    "OpportunityType" : Opptype
                action.setCallback(this, function(response) {
                      var quoteRecordId = response.getReturnValue();
                      component.set("v.quoteRecordValue", quoteRecordId);
console.log(component.get("v.quoteRecordId "); <--- both console logs return values

now how exactly am i supposed to pass the value of quoteRecordId unto a helper function? Because on the helper when i use component.get("v.quoteRecordId"); i get undefined. Hell if i try to component.get that value afer the enqueueAction it's still undefined...

showCreateRecordModal : function(component) {

    component.get("v.quoteRecordValue");  <---undefined.

This is when i run console log

Edit: missed a copy paste

  • you have not defined the action. Define action with apex method name. and make sure you are getting value in quoteRecordId, by putting debug log.
    – Amol
    May 6, 2021 at 9:19
  • looks like you have not used proper syntax for calling apex method from JS controller. Use var action = component.get("c.apexMethodName"); Please try to post your complete code including markup and apex controller
    – Manu Tej
    May 6, 2021 at 9:30
  • yeah i missed that part when adding copying the code over into the post, updated.
    – ensir
    May 6, 2021 at 15:47

1 Answer 1


You have not defined the action. you need to define action with apex method name.

Ex. let action = component.get("c.getExpenses");

Where getExpenses is the Name of Apex method.

You can refer this trailhead

Put the debug log and check you are getting value in quoteRecordId variable.

If you have to use quoteRecordId value in other function then you can save that value using component.set() method. else you can directly pass value to other function.

doInit: function(component, event, helper) {

showCreateRecordModal: function(component,quoteRecordId){
  • i missed that when copy --> pasting my code in. it's now defined.
    – ensir
    May 6, 2021 at 15:46

You must log in to answer this question.

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