What are Salesforce Big Objects?

Hey friends, we all know that objects in Salesforce are used to manage and manipulate our data. You’re probably pretty familiar with standard objects, custom objects, and external objects. But if you have to manage an enormous amount of data then that’s where you’ll want to leverage Salesforce Big Objects. These objects manage billions of records of data without compromising performance. Salesforce Big Objects allow you to source massive datasets from external systems into a big object, for a complete view of your customers. The greatest benefit of Big Objects is that it does not count against the data storage limit.

Clients and external systems can use a standard set of APIs to access the data of Big Objects. Big Objects are available for both Salesforce Classic and Lightning Experience. 

Types of Salesforce Big Objects

There are 2 types of Big Objects:

  1. The Standard Big Object: They are defined by Salesforce. They include FieldHistoryArchive and are part of theField Audit Trail product. This is helpful for organizations that have a use case for regulations on auditing and data retention.
  2. The Custom Big Objects: They are defined by the user as per their requirement. You can implement a custom big object by using the Metadata API. 

Use Cases for Salesforce Big Objects

  1. 360° View of the Customer: When you have a lot of customer information to store from an external system, you’ll want to use a Big Object in order to get a complete view of the customer. For example, data from a customer loyalty program would be a great use case for a big object.
  2. Historical Archive: When you have historical information that you don’t necessarily need at your fingertips, but may need to refer back to for reasons such as compliance, or a customer’s transaction history, a big object is a great option.

Considerations for using Salesforce Big Objects 

  1. Big objects only support object and field permission. So you can implement sharing based rules on this.
  2. You can’t use standard features of Salesforce like triggers, flows, processes on Big Objects.
  3. You can create up to 100 big objects per org. The limit of the number of fields on the big object is similar to the custom object and it depends on your org’s edition and licensing.
  4. You can create big objects and fields from the UI as well as using Metadata API.
  5. Big objects available in Enterprise, Performance, Unlimited, and Developer Editions with one million records limit but by using an add-on license we can increase record capacity and Async SOQL.
  6. Suffix for the big objects is __b.
  7. Big Objects support custom Salesforce Lightning and Visualforce components instead of standard UI elements like detail pages, list views, and so on.
  8. Big objects only support Lookup Relationship,  Date, Time, Email, Number, Phone, Text, Long Text Area, and URL Field types. 
  9. Big objects do not support encryption.

How to Create Big Objects in Salesforce

We can define custom big objects with Setup and Metadata API. After defining the big objects we can add fields to it from the setup. To complete the setup of big objects we need to create a custom index. We can’t edit and delete the index. 

How to Create Big Objects with Metadata API

To create the big objects from Metadata API we need an object file that contains the following:

  • Object Files: Create a file that contains definitions of big objects, fields, and index.
  • PermissionSet/Profile Files: This is not the required file but this file is used to assign the object and field permissions. This grants big object access to the user because by default big objects are restricted.
  • Package File: A file for the deployment of metadata definitions and permission.

Let’s see the example. I’m creating an “Old Case History” big object. 

  1. We need to create an object file with .object extension.

Old_Case_History__b.object

<?xml version=”1.0″ encoding=”UTF-8″?>

<CustomObject xmlns=”https://soap.sforce.com/2006/04/metadata”>

    <deploymentStatus>Deployed</deploymentStatus>

 

    <fields>

        <fullName>Account__c</fullName>

        <label>User Account</label>

        <referenceTo>Account</referenceTo>

        <relationshipName>Old_Case_History_Account</relationshipName>

        <required>true</required>

        <type>Lookup</type>

    </fields>

    

    <fields>

        <fullName>Case_Number__c</fullName>

        <label>Case Number</label>

        <length>16</length>

        <required>true</required>

        <type>Text</type>

        <unique>false</unique>

    </fields>

    

    <fields>

        <fullName>Contact_Name__c</fullName>

        <label>Contact Name</label>

        <length>255</length>

        <required>false</required>

        <type>Text</type>

        <unique>false</unique>

    </fields>

    

    <fields>

        <fullName>Subject__c</fullName>

        <label>Subject</label>

        <length>255</length>

        <required>false</required>

        <type>Text</type>

        <unique>false</unique>

    </fields>

    

     <fields>

        <fullName>Description__c</fullName>

        <label>Description</label>

        <length>32000</length>

        <required>false</required>

        <type>LongTextArea</type>

        <unique>false</unique>

<visibleLines>3</visibleLines>

    </fields>

 

    <indexes>

        <fullName>OldCaseHistoryIndex</fullName>

        <label>Old Case History Index</label>

        <fields>

            <name>Account__c</name>

            <sortDirection>DESC</sortDirection>

        </fields>

        <fields>

            <name>Case_Number__c</name>

            <sortDirection>ASC</sortDirection>

        </fields>       

    </indexes>

    

    <label>Old Case History</label>

    <pluralLabel>Old Case History</pluralLabel>

</CustomObject>

  1. We need to create a permission set file with the .permissionSet extension.

Old_Case_History__b.permissionSet

<?xml version=”1.0″ encoding=”UTF-8″?>

<PermissionSet xmlns=”https://soap.sforce.com/2006/04/metadata”>

     

    <label>Old Case History Permission Set</label>

     

    <fieldPermissions>

        <editable>true</editable>

        <field>Old_Case_History__b.Account__c</field>

        <readable>true</readable>

    </fieldPermissions>

     

    <fieldPermissions>

        <editable>true</editable>

        <field>Old_Case_History__b.Case_Number__c</field>

        <readable>true</readable>

    </fieldPermissions>

     

    <fieldPermissions>

        <editable>true</editable>

        <field>Old_Case_History__b.Contact_Name__c</field>

        <readable>true</readable>

    </fieldPermissions>

     

     

    <fieldPermissions>

        <editable>true</editable>

        <field>Old_Case_History__b.Subject__c</field>

        <readable>true</readable>

    </fieldPermissions>

     

    <fieldPermissions>

        <editable>true</editable>

        <field>Old_Case_History__b.Description__c</field>

        <readable>true</readable>

    </fieldPermissions>

     

 

</PermissionSet>

  1. The final step is to create a package file. 

Package.xml

<?xml version=”1.0″ encoding=”UTF-8″?>

<Package xmlns=”https://soap.sforce.com/2006/04/metadata”>

    <types>

        <members>*</members>

        <name>CustomObject</name>

    </types>

    <types>

        <members>*</members>

        <name>PermissionSet</name>

    </types>

    <version>50.0</version>

</Package>

How to Deploy a Salesforce Big Object 

To deploy the big object, we need to create the following structure of the files.

  1. Create a folder “objects” and move the .object file to this folder. 
  2. Create a folder “permissionSets” and move the .permissionSet file to this folder.
  3. Finally create a zip file with objects folder, permissionSets folder, and package.xml file. 

What are Salesforce Big Objects?

4.  Now, we can deploy this with the help of workbench. Login to workbench.
5.  Select the migration tab, and select deploy. Then choose the .zip file from your system and check the ‘Single Package’ and click the ‘Nextoption as shown below.

What are Salesforce Big Objects?

6. On this screen, you’ll see the deploy button. Click on deploy to push the big object to your org.

What are Salesforce Big Objects?

7. This will redirect you to the result screen.

What are Salesforce Big Objects?

8. Once you have successfully deployed a Salesforce Big Object you can validate the big object in your Salesforce org.

What are Salesforce Big Objects?

How to create a Salesforce big object record with Apex

You can create big object records using CSV files and Apex code.
CSV File: Use a data loader to import the records.
Apex Code: We can insert the data in big objects using Database.insertImmediate().

Old_Case_History__b obj = new Old_Case_History__b();

obj.Account__c = ‘0010K00002NezhdQAB’;

obj.Case_Number__c = ‘00215656’;

obj.Contact_Name__c = ‘Nidhi Vyas’;

obj.Description__c = ‘This is a testing record.’;

obj.Subject__c = ‘Test Check’;

database.insertImmediate(obj);


SOQL with Big Objects

In the big object there are some limitations with SOQL. 

  1. The soql doesn’t support !=, LIKE, NOT IN, EXCLUDES, and INCLUDES operators. 
  2. Aggregate functions are not supported.

SELECT Account__c, Case_Number__c, Contact_Name__c, Description__c, Subject__c FROM Old_Case_History__b 

WHERE Account__c =’0010K00002NezhdQAB’ 

Conclusion 

When designing any system, it’s always important to consider the volume. As a developer, data storage is a common issue you will run into. But big objects help us to maintain an enormous amount of data without hindering the performance of the system. Big objects provide us with the flexibility to store large amounts of data without worrying about storage capacity. Salesforce Big Objects can help businesses and developers manage large amounts of data. If you still need assistance with your Salesforce Big Objects, feel free to reach out to us. We can provide a free consultation or discuss our Salesforce implementation and consultation services.

For educational videos be sure to visit our YouTube channel where you can check out quick videos and how-tos for all things Salesforce. While you’re there don’t forget to subscribe! You can also subscribe to our blog to receive weekly updates on the Salesforce topics you want to hear about.

Nidhi Vyas

Nidhi Vyas

Salesforce Developer

Nidhi is a talented Salesforce Developer. She has strong development and management skills and is always eager to meet the challenge of new territories in her roles. She has a passion to continuously achieve her goals and learn.

About Roycon
We’re an Austin-based Salesforce Consulting Partner, with a passion and belief that the Salesforce platform’s capabilities can help businesses run more efficiently and effectively. Whether you are just getting started with Salesforce or looking to realize its full potential, Roycon specializes in Salesforce Implementations, Salesforce Ongoing Support, and Salesforce Integrations, and Development. We’re the certified partner to guide the way to increase Salesforce Adoption, make strategic decisions, and build your Salesforce Roadmap for success.

Tweet
Share