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

getReturnValue .field not working JS controller

Hi ,
help me on this below issue , how to resolve 
      field API name passing from design:attribut to fieldname attribute

       var fields = component.get("v.fieldname");

        console.log('fieldapiname'+fields); // getting field api name

        var action = component.get("c.getimagesresponse");
            recId: recordId,
        action.setCallback(this, function(a) {
  var sobjectrecord = a.getReturnValue().fields; // Not working 
 console.log('fieldname '+sobjectrecord ); // getting undefined
 var sobjectrecord = a.getReturnValue().No_of_licencess__c ; //hardcoded field API name, when passing field API name returnning correct result 
 console.log('fieldname '+sobjectrecord );  // sucess 

  i want to pass field API name dynamically , how to resolve this issue .
Thanks in Advance 
Balagopal GBalagopal G

Hi ,

check how the response is coming , then try to assign it to sobjectrecord  accordingly.

console.log(a.getReturnValue()) what it gives?!.