1

First of all i am very new in salesforce and not have anything to do with programming however i have been trying to finish my first project by getting help online. I have created a BIG OBJECT "Email_Archive_b" and VF page "EmailArchive" to show the Email data in table. In the Email Archive VF page I have a a "ParentID__C" which holds the ID of "case's Emails". when i import the data from workbench all the cases data is shown in VF page enter image description here

IF you look at the above sceenshot The case is "test case 1" and Its ID is "00014319" but the data is shown of all the case's Emails. Is there a way where i can only see data of the related case on their Specific VF pages.what should i change in my apex class and VF coding that i can get the required result when i import data.

public class EmailArchive{
public List<Email_Archive__b> listOfEmailArchive {get;set;}
public EmailArchive(){
    listOfEmailArchive = [SELECT ID__c, Parent_ID__c, Message_Date__c, Subject__c, Text_Body__c, HTML_Body__c, FROM_ADDRESS__c, TO_ADDRESS__C  FROM Email_Archive__b];
    if(listOfEmailArchive == null){
        listOfEmailArchive = new List<Email_Archive__b>();
    }
}
}

VF code:

<apex:page controller="EmailArchive" title="Email Archive">
<apex:sectionHeader title="EmailArchive" subtitle="All Archived Email"/>
<apex:pageBlock >
    <apex:pageBlockSection columns="1" >
        <apex:pageBlockTable value="{!listOfEmailArchive}" var="email">
        <apex:column value="{!email.ID__c}"/>  
        <apex:column value="{!email.Parent_ID__c}"/>
        <apex:column value="{!email.Message_Date__c}"/>
        <apex:column value="{!email.Subject__c}"/>
        <apex:column value="{!email.Text_Body__c}"/>
        <apex:column value="{!email.HTML_Body__c}"/>
        <apex:column value="{!email.FROM_ADDRESS__c}"/>
        <apex:column value="{!email.TO_ADDRESS__c}"/>    
       </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>

Index Schema Screenshot

enter image description here

I would appreciate your help please Thank you

8
  • 1
    Okay, Can you open the Schema of the Big Object Email_Archive__b and look for the Index Position of Parent_ID__c field? Commented Dec 6, 2018 at 15:56
  • @PranayJaiswal thank you for getting back...the parentid field is at number 1 in my indexes .......................... i am going to upload a screenshot in my post
    – zsk_1
    Commented Dec 6, 2018 at 16:01
  • How would the index position affect the filtering of Cases emails when i import data?
    – zsk_1
    Commented Dec 6, 2018 at 16:07
  • @PranayJaiswal hi pranay I am unable to see the TEXT BODY Field in my Email Archive VF page..every other field is showing..do you know what could be the reason?
    – zsk_1
    Commented Dec 11, 2018 at 14:50

1 Answer 1

0

As I can see from your XML, Parent_ID__c is the first index in your XML. Thus you can use it in your filter. If that was not the first index then it would be harder to use filter in your SOQL

According to SF:

For SOQL queries with big objects, you have to build your query starting from the first field defined in the index, without skipping any fields between the first and last field in the query. So for example, if your index defines three fields, you can’t create a query using only the first and third fields.

You can get Id of current record using

`ApexPages.currentPage().getParameters().get('id')` 

and can then use that id in your SOQL filter.

public class EmailArchive{
    public List<Email_Archive__b> listOfEmailArchive {get;set;}
    public EmailArchive(){
        Id currentCaseId = ApexPages.currentPage().getParameters().get('id');
        listOfEmailArchive = [SELECT ID__c, Parent_ID__c, Message_Date__c, Subject__c, Text_Body__c, HTML_Body__c, FROM_ADDRESS__c, TO_ADDRESS__C  FROM Email_Archive__b where Parent_ID__c=:currentCaseId];
        if(listOfEmailArchive == null){
            listOfEmailArchive = new List<Email_Archive__b>();
        }
    }
}

Src: https://trailhead.salesforce.com/en/content/learn/modules/big_objects/big_objects_querying

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .