I have a very basic method that correctly returns the value of the Name field of my custom object. However, when I try to retrieve the value of a custom field I get isnull as the result. I checked the field level security and I have rights to the custom fields. If I use the query editor in the Developer Console and run the same query, I get the correct results.
@AuraEnabled
global static String getEventName(String eventRecordId)
{
return [SELECT Event__c.Name FROM Event__c WHERE Id = 'a0M6A000004KFdtUAG' AND NetworkId__c = :netwrkId].Name;
}
({
doInit : function(component, event, helper) {
var action = component.get("c.getEventName");
action.setParams({
eventRecordId: component.get("v.recordId")
});
action.setCallback(this, function(response) {
var testmk= response.getReturnValue();
alert('result is' + testmk);
component.set("v.eventName", testmk);
});
$A.enqueueAction(action);
},
The following query is not working:
@AuraEnabled
global static String getEventName(String eventRecordId)
{
return [SELECT Subheadline__c FROM Event__c WHERE Id = 'a0M6A000004KFdtUAG' AND NetworkId__c = :netwrkId].Name;
}
.Name
, rather than.Subheadline__c
.