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
MrBrianMrBrian 

Big Object Related List through VisualForce?

Hello,

I have successfully deployed a big object called "Archived_Tasks__b" in a sandbox instance; I would like to use this object to archive old tasks to, but still be able to view them on a related list or on a visual force page if needed. I found a great resource that I adapted to build a custom controller and visual force page to expose the big object data (https://rajvakati.com/2017/10/19/salesforce-big-objects/ at end of page). However, when I implemented this code, the related list on the account page shows every big object Archived_Tasks __b, not just the ones related to the account.

I have also tried using the "apex:relatedList" code, but this does not seem to be supported for big objects, as every time I try it, I get the message on the account page: "Content cannot be displayed: 'Account_Archived_Tasks__r' is not a valid child relationship name for entity Account". I have tried multiple permutations of the child object name with no luck.

How can I only display the relevant big object records? What if I wanted to show this as a link to a list page instead of a related list (so it doesn't have to load on every account page)?

Page Example:
<apex:page standardController="Sales_Order__c" extensions="BigObjectData">
    <apex:form>
        
        <apex:pageBlock>
            <apex:pageBlockSection title="Big Objects" columns="1">
                <apex:pageBlockTable value="{!boData}" var="bo">
                    <apex:column headerValue="Actual Cost">
                        <apex:outputField value="{!bo.Actual_Cost__c}"/>
                    </apex:column>
                    <apex:column headerValue="Sales Channel">
                        <apex:outputField value="{!bo.Saleschannel__c}"/>
                    </apex:column>
                  
                      <apex:column headerValue="Created from ">
                        <apex:outputField value="{!bo.Created_From__c}"/>
                    </apex:column>
                  
                  
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller Example: 
public class BigObjectData {
    private  List<Sales_OrderBO__b> orderDetails; 
    public BigObjectData(ApexPages.StandardController con)
    {
        boData = fetchData();
    } 
    public List<Sales_OrderBO__b> fetchData()
    {
        return [Select Id ,Saleschannel__c ,Created_From__c,SalesorderBORel__c,Expired_Date__c,Actual_Cost__c
                from Sales_OrderBO__b ];
    }
    
    public List<Sales_OrderBO__b> boData{get;set;}
    
}

Really appreciate the help!
-Brian
Tom Arena 5Tom Arena 5
In case anyone ends up here:

 public List<Sales_OrderBO__b> fetchData() {
    return [
        Select Id ,Saleschannel__c ,Created_From__c,SalesorderBORel__c,Expired_Date__c,Actual_Cost__c
        from Sales_OrderBO__b
    ];
}

There isn't a WHERE clause in the SOQL. If you want to limit the return to records related to your current record then you need to add a reference to the Id of the record you want to return:

WHERE RecordId = :ApexPages.currentPage().getParameters().get('id')