You need to sign in to do that
Don't have an account?
Sylvie Serplet
Comparing fields in two different objects in a SOQL
Hi All,
I am trying to retrieve a list of records for a custom object (Fact_Finder__c) which has the same Account name as the Opportunity in where the list is displayed (in a Ligthning Component). There is a master detail relationship between the Opportunity (parent) and the Fact Finder (child).
My current code (below) retrieve records for this particular Opportunity but what I want to achieve is retrieving all the Fact Finders with the same Account name in all Opportunities.
public with sharing class FFsamePolicysameClient {
@AuraEnabled
public static List<Fact_Finder__c> getallFF(String recordId){
List <Fact_Finder__c> FF = [SELECT Id, Name, RecordType.Name, Date__c, Client_Name__r.Name, Policy__r.Name, Opportunity_Name__r.Name FROM Fact_Finder__c Where (Opportunity_Name__c =:recordId) ORDER BY Date__c DESC];
return FF;
}
}
I have tried many different ways but nothing seams to work.
Any help will be greatly appreciated.
Thanks in advance.
Sylvie
I am trying to retrieve a list of records for a custom object (Fact_Finder__c) which has the same Account name as the Opportunity in where the list is displayed (in a Ligthning Component). There is a master detail relationship between the Opportunity (parent) and the Fact Finder (child).
My current code (below) retrieve records for this particular Opportunity but what I want to achieve is retrieving all the Fact Finders with the same Account name in all Opportunities.
public with sharing class FFsamePolicysameClient {
@AuraEnabled
public static List<Fact_Finder__c> getallFF(String recordId){
List <Fact_Finder__c> FF = [SELECT Id, Name, RecordType.Name, Date__c, Client_Name__r.Name, Policy__r.Name, Opportunity_Name__r.Name FROM Fact_Finder__c Where (Opportunity_Name__c =:recordId) ORDER BY Date__c DESC];
return FF;
}
}
I have tried many different ways but nothing seams to work.
Any help will be greatly appreciated.
Thanks in advance.
Sylvie
See tht updated apex controller.
And for showing list of Facts and Finder on Lightning component, please follow the following article, which will help you alot.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm
Thanks
All Answers
What I have understood is that you want to retrieve all Fact Finders that are related to opportunity's Account. Correct me if I am wrong.
Please try below code
Thanks
And yes, I try to retrieve all Fact Finders that are related to opportunity's Account.
I got the following error message :Unknown controller action 'getallFF'
My Lightning component is as follow:
Component
Controller
Thank you for your help.
Sylvie
See tht updated apex controller.
And for showing list of Facts and Finder on Lightning component, please follow the following article, which will help you alot.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm
Thanks