At the moment I have two main queries (College Application and Recommendations). Both "join" up to Contact for Student Name, Gender, etc. I'm doing this using SOQL in Workbench.

But I'd like to keep these as "clean" as possible, but then JOIN them together to create a larger dataset.

Is this possible? Is it possible to create a VIEW (like in Oracle) and then "JOIN" the two views?

*Having a hard time grasping how to pull data out of SF, for various analytical purposes.

  • To get data from different objects similar to a Oracle view, take a look at Joined Report in Salesforce. Go to Reports and create a new report and select 'Obj1'. In report builder, select Joined Report. Create a new block by dragging 'obj2' into the preview pane again to the right of the existing table block. Just drag the fields you want into each of the two tables. You can set separate filtering criteria for each one. You should be able to filter the tables based on a variety of criteria, including custom cross-filters. – GroundToCloud Feb 2 at 15:38
  • Thank you! I'll have a look at Joined Report ... – WmPeck1958 Feb 2 at 20:00

There is no feature like VIEW in Salesforce. You must get the data from SOQL where you can perform Joins on multiple tables using relationship queries or you can use apex where you can store the result of SOQL in MAPs and then use the KeySet() from Map and perform another Query.

Option 1

List<CollegeApplication__c> appList = [SELECT Id, Name, (Select Id, Name FROM Recommendations__r) FROM CollegeApplication__c Where Name = 'XYZ' ]
    for (CollegeApplication__c app : appList){
        for(Recommendations__c recom : app.Recommendations__r){
            System.debug('Application: '+ app);
            System.debug('Recommendation: '+ recom);

Option 2

Map<Id,CollegeApplication__c> appMap = new Map<Id,CollegeApplication__c>([SELECT Id, Name FROM CollegeApplication__c Where Name = 'XYZ' ]);
List<Recommendations__c> recomList = [Select Id, Name FROM Recommendations__c WHERE Application__c IN : appMap.KeySet()];

for(Recommendations__c recom : recomList){
    System.debug('Recommendation: '+ recom);
    System.debug('Application: '+ appMap.get(recom.Application__c));
  • Nishant, thank you! (I've got a long way to go ...) – WmPeck1958 Feb 2 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.