You need to sign in to do that
Don't have an account?
MAITREYEE DINGARE
Variable does not exist: Apex @AuraEnabled method error
Hello all,
I am very new to APEX, and I am trying to match the Account Id of one custom object to another customer custom object. I am using this code into Lightning Component, so I have used @AuraEnabled. I am getting variable does not exist error for variable 'besuchsbericht'. Here is my code snippet:
Any help would be appreciated.
Thank you!
Maitreyee Dingare
I am very new to APEX, and I am trying to match the Account Id of one custom object to another customer custom object. I am using this code into Lightning Component, so I have used @AuraEnabled. I am getting variable does not exist error for variable 'besuchsbericht'. Here is my code snippet:
public class PriceBookEntriesFromAccount { @AuraEnabled public Id currentBB{get; set;} public PriceBookEntriesFromAccount(ApexPages.StandardController controller) { currentBB = Apexpages.currentpage().getParameters().get('id'); } @AuraEnabled public list<Besuchsbericht__c> besuchsbericht = [SELECT Unternehmen__r.Name FROM Besuchsbericht__c WHERE Id =:currentBB]; @AuraEnabled public static List<BB_Produkt__c> getPriceBookEntries() { List<BB_Produkt__c> bb = [SELECT Name, Id, Produkt__r.Name, Verkostung__c, Kaufinteresse__c, Unternehmen__r.Name FROM BB_Produkt__c WHERE Unternehmen__r.Name = :besuchsbericht]; //Add isAccessible() check return bb; } }My apologies for some variable names in the German language.
Any help would be appreciated.
Thank you!
Maitreyee Dingare
This code is valid for Visualforce:
Instead you need to implement : forceRecordId in Aura Cmp. This will get the value from the URL and then you need to supply this id from JS Action call to server.
Here is the the example: https://salesforce.stackexchange.com/questions/187005/how-send-the-parameter-recordid-from-lightning-component-to-apex-controller
Thanks,
Ashish Singh.
All Answers
This code is valid for Visualforce:
Instead you need to implement : forceRecordId in Aura Cmp. This will get the value from the URL and then you need to supply this id from JS Action call to server.
Here is the the example: https://salesforce.stackexchange.com/questions/187005/how-send-the-parameter-recordid-from-lightning-component-to-apex-controller
Thanks,
Ashish Singh.